修复两栏布局不能固定 #profile 的问题 (#320)
parent
29235f6d3a
commit
a4ef07b8c4
|
@ -43,23 +43,21 @@
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// To Top & Fixed Profile
|
// To Top
|
||||||
var sidebarElem = $('#sidebar'),
|
var sidebarElem = $('#sidebar'),
|
||||||
toTopElem = $('#toTop');
|
toTopElem = $('#toTop');
|
||||||
|
|
||||||
if (sidebarElem.length) {
|
(function () {
|
||||||
checkDisplayToTop();
|
if (!sidebarElem.length) return;
|
||||||
checkFixedProfile();
|
|
||||||
|
|
||||||
|
checkDisplayToTop();
|
||||||
$(document).on('scroll', function () {
|
$(document).on('scroll', function () {
|
||||||
checkDisplayToTop();
|
checkDisplayToTop();
|
||||||
checkFixedProfile();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toTopElem.click(function () {
|
toTopElem.click(function () {
|
||||||
$('body, html').animate({ scrollTop: 0 }, 600);
|
$('body, html').animate({ scrollTop: 0 }, 600);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
var isToTopDisplayed = false;
|
var isToTopDisplayed = false;
|
||||||
function checkDisplayToTop() {
|
function checkDisplayToTop() {
|
||||||
|
@ -83,6 +81,14 @@
|
||||||
toTopElem.css('right', 20);
|
toTopElem.css('right', 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Fixed Profile
|
||||||
|
(function () {
|
||||||
|
checkFixedProfile();
|
||||||
|
$(document).on('scroll', function () {
|
||||||
|
checkFixedProfile();
|
||||||
|
});
|
||||||
|
|
||||||
var isFixedProfile = false;
|
var isFixedProfile = false;
|
||||||
function checkFixedProfile() {
|
function checkFixedProfile() {
|
||||||
|
@ -115,5 +121,6 @@
|
||||||
isFixedProfile = false;
|
isFixedProfile = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
Loading…
Reference in New Issue