views:

350

answers:

3

Please check out this page: http://onomadesign.com/wordpress/identity-design/hans-appenzeller/

The thumbnails on the right, link to different portfolio items (Wordpress single posts). I want the thumbnail of the active project to be vertically centred in the scrollbar when the user enters the page. Right now, it resets the scrollbar, so people lose sight of navigation. How to accomplish this using jQuery?

Thanks.

A: 

First add the class of "selected" to the li of the current link and use that class to add your margin rather then inline css

Looks like you are using the jScrollPlane Plugin. Which will let you do something like this with your current code.

$('.jScrollPaneContainer').scrollTo('.currentthumb');

See this page for the jScrollPlane scrollTo functionality

PetersenDidIt
Thanks. But I get this error: Error: o.easing[this.options.easing || (o.easing.swing ? "swing" : "linear")] is not a functionSource File: http://onomadesign.com/wordpress/wp-content/plugins/carousel-gallery-jquery/jquery-1.3.2.min.js?ver=1.3.2Line: 19
Josh
Remove the {easing: 'elasout'}. Its a fancier animation that is included in a different file.
PetersenDidIt
I removed it, still not scrolling though. I tried every different selector possible, what am I doing wrong here? Thanks
Josh
I updated my answer, no need for the other plugin, didn't see you had the jScrollPlane plugin. It already has a scrollTo function. Also seems like you added the selected class to every li element, not just the one that is truly selected at the time.
PetersenDidIt
It works!!! Thank you very much! Now I'm gonna try to add a nice easing effect to it like you suggested earlier:)
Josh
A: 
Tatu Ulmanen
Error: window.height is not a functionSource File: http://onomadesign.com/wordpress/identity-design/edgemont-capital-partners-lp/Line: 161
Josh
Yea, that should have been a jQuery object (`$(window)` instead of `window`). Fixed. Hopefully there aren't any more errors :)
Tatu Ulmanen
No errors anymore. But still not working. What do you think of petersendidit's solution?
Josh
It should work but the scrollTo plugin is optional, it should work allright like in my version. I guess the problem is in the 'faux' scrollable div, it doesn't work properly with scrollTop. I have to think about this for a while, I'll update my answer if I'm able to test this myself first.
Tatu Ulmanen
OK, thank you for your trouble.
Josh
Did you find out anything new?
Josh
A: 

I found out that the jScrollPane plugin, has a ScrollTo function of his own: http://www.kelvinluck.com/assets/jquery/jScrollPane/scrollTo.html. Even with jQuery selectors (at the bottom).

And I managed to give the current thumbnail image a class, called 'currentthumb'.

Now I just need to make that ScrollTo function happen on page load and not on a click event, right? This looks to be easier, no?

Thanks.

Josh