有一个问题,即jQuery scrollTop根本不会动画。
这是我的代码。
function nextSection() {
var counter = $('.current .subpage').size();
var $this = $('.current > .subcurrent');
if(settings.subcount != counter) {
$this.next().addClass('subcurrent');
$this.removeClass('subcurrent');
settings.subcount++;
$('.current').stop().animate({scrollTop : $this.next().offset().top}, settings.speed, settings.easing);
}
}
function prevSection() {
var counter = $('.current > .subpage').size();
var $this = $('.current > .subcurrent');
if(settings.subcount != 1) {
$this.prev().addClass('subcurrent');
$this.removeClass('subcurrent');
settings.subcount--;
$('.current').stop().animate({scrollTop : $this.offset().top}, settings.speed, settings.easing);
}
}
这些功能设置为上下键,
scrollLeft
使用以下代码。
$this.prev().addClass('current');
$this.removeClass('current');
settings.count--;
elements.page.stop().animate({scrollLeft : $('.current').offset().left}, settings.speed, settings.easing);