当窗口大小低于 770 像素时,我该怎么做才能禁用整个以下功能?并在屏幕大小超过 770 像素时再次启用它......我们可以使用 JavaScript 来实现吗?
这是需要禁用的整个函数/代码/片段:
//Sticky Box //
$(function () {
$.fn.scrollBottom = function () {
return $(document).height() - this.scrollTop() - this.height();
};
var $StickyBox = $('.detailsBox');
var $window = $(window);
$window.bind("scroll resize", function () {
var gap = $window.height() - $StickyBox.height() - 10;
var visibleFoot = 255 - $window.scrollBottom();
var scrollTop = $window.scrollTop();
if (scrollTop < 50) {
$StickyBox.css({
top: (130 - scrollTop) + "px",
bottom: "auto"
});
} else if (visibleFoot > gap - 100) {
$StickyBox.css({
top: "auto",
bottom: visibleFoot + "px"
});
} else {
$StickyBox.css({
top: 80,
bottom: "auto"
});
}
});
});