views:

348

answers:

1

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'} );
});

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!

+1  A: 

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'} );
});
sirhc
Perfect. Thanks :)
steve