就像http://lorem.in里面一样。
但我自己写的在滚动前都会颤抖。
怎么处理呢?
自己本来是这么写的:
height是窗口高度。
var getscroll = function() {
$.getScript("script/mousewheel.min.js");
$(window).bind('mousewheel', function(event, delta, deltaX, deltaY) {
if (deltaY < 0) {
t = $("body").scrollTop();
t = t - t % height;
$(document.body).animate({
'scrollTop': t + height
}, 700);
} else if (deltaY > 0) {
t = $("body").scrollTop();
t = t - t % height;
$(document.body).animate({
'scrollTop': t - height
}, 700);
}
});
}
getscroll();
但我自己写的在滚动前都会颤抖。
怎么处理呢?
自己本来是这么写的:
height是窗口高度。
var getscroll = function() {
$.getScript("script/mousewheel.min.js");
$(window).bind('mousewheel', function(event, delta, deltaX, deltaY) {
if (deltaY < 0) {
t = $("body").scrollTop();
t = t - t % height;
$(document.body).animate({
'scrollTop': t + height
}, 700);
} else if (deltaY > 0) {
t = $("body").scrollTop();
t = t - t % height;
$(document.body).animate({
'scrollTop': t - height
}, 700);
}
});
}
getscroll();