【发布时间】:2013-09-07 21:28:36
【问题描述】:
当窗口大小低于 770 像素时,我该怎么做才能禁用整个以下功能?并在屏幕大小超过 770 像素时再次启用它......我们可以使用 JavaScript 来实现吗?
这里是需要禁用的整个函数/代码/sn-p:
//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"
});
}
});
});
【问题讨论】:
-
上面的全部代码,不就是调用函数吗?抱歉,我是新手。
标签: javascript jquery