Need to use position() instead of offset() and also need to set the description to be position:relative .
Up vote 1 down vote favorite share g+ share fb share tw.
So im basically using a link, to scroll through a series of divs to select the correct one. Ie click on happy, and scrolls to 'happy' div, However, the scroll seems to not go to what its linked to, but scrolls to the third div in the list. Heres the code: My Portfolio Kazooki Universe of Downhill Kudia description kazooki Universe of Downhill kudia javascript jquery div scrolltop link|improve this question edited Nov 16 '10 at 20:50Robusto12.4k21127 asked Nov 16 '10 at 20:43Jonathan 82.
Need to use position() instead of offset() and also need to set the #description to be position:relative. Then you need to factor in the current scrollTop. Last you need to cancel the default click behavior.
Complete example at jsfiddle.net/gaby/TneA6.
This works fantastically! – Jonathan Nov 18 '10 at 13:08.
It's probably just scrolling to the very bottom of the page -- it can't align the top of the div with the top of the page because the page ends. Try adding a bunch of empty space at the bottom of the page (a or something) and see if it still results in the unexpected behavior.
Ok, ive tried that. Still scrolls to the bottom of the div when a link is clicked. However now when a link is re-clicked it will scroll up to the very first div.
– Jonathan Nov 16 '10 at 20:52.
I guess you need to prevent the usual behaviour of the click: $(". Row1 > a"). Click(function(e) { // prevent default behaviour e.preventDefault(); // Call the scroll function goToByScroll($(this).
Attr("id")); }); Just guessing though.
Originally had this, but made no difference. Just tried added it again and testing and no difference is made with this. – Jonathan Nov 16 '10 at 20:54.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.