开发者

jquery scrollpane and scrollTo at same time

Current demo here: http://www.studioimbrue.com/sites/eliotdudik

I have the tabs system working wonderfully. I'm trying to get it so that if you're down a ways on the gallery and then click "foreword" or any menu item, it scrolls you back to 0,0.

The current sliding code is as follows:

$('#wrapper ul li').click(function() {
    $(window).scrollTo($(this).next('li'), 500, {offset: {top:0, left:-50}}, {easing:'easeOutExpo'} );
});
开发者_如何学Go

And I'm trying to add something like this under it:

$('#menu li').click(function() {
    $(window).scrollTo(0,0, 500, {offset: {top:0, left:-50}}, {easing:'easeOutExpo'} );
});

It continues switching tabs, but it won't scroll back to the beginning!


The click events are not being delegated into the li elements. You have to target the a (anchor) elements instead. So here goes:

$('#menu li a').click(function() {
    $(window).scrollTo(0,0, 500, {offset: {top:0, left:-50}}, {easing:'easeOutExpo'} );
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜