[jQuery] Scrolling Problem
Hi I have div1 class=post div class=title div2 class=post div class=title div3 id=post div class=title div10 id=post div class=title I am trying: clicking on div#title belonging to div1 scrolls to div#title belonging to div2 and so on to cut a long story short clicking on div#title scrolls to the next div#title and so on I have tried and not succeded so far Any help will be very much appreciated jean
Re: [jQuery] Scrolling Problem
On Sat, Feb 20, 2010 at 9:13 AM, macgyver47 jrl...@wanadoo.fr wrote: div1 class=post div class=title div10 id=post div class=title I am trying: clicking on div#title belonging to div1 scrolls to div#title belonging to div2 and so on $().ready(function() { $(.title).click(function() { var thisPost = $(this).parent(); var nextPost = thisPost.next(.post); if ( ! nextPost.length ) nextPost = thisPost.parent().find(.post); var positionOfNextTitle = nextPost.find(.title).position(); // or offset() window.scrollTo(positionOfNextTitle.left, positionOfNextTitle.top); }); }); http://jsbin.com/adoti/edit Nathan
[jQuery] Scrolling problem
I managed to get the scrolling to kinda work – if I set it up with static LI then I can get the scrolling to work the way I want it to, sans being able to pass the number of the image I want to be shown (unless I put it in the text field of the anchor tag, which shows with the image) but I have no way of passing the other variables to call my updating button. Also, using the static it takes much longer to load the page. I’m looking to be able to set a variable – like NewStrt – to be the first image in the carousel by calling a simple function such as ScrollTo(NewStrt) or mycarousel.ScrollTo(NewStrt). Using the “function mycarousel_initCallback(carousel)” scrolling function doesn’t work with dynamic loading, and I can’t pass my variables with static loading. Please help. If you would like to see what I'm doing to get a better idea, you can see it here (along with my current code): http://ssbbs.dyndns.org/panic/rpicts.asp Thanks in advance for any assistance with this. Kevin