Sunday, 15 September 2013

alternative of scrollLeft()

alternative of scrollLeft()

G'day!


I have a page which has Horizontally Scroll feature going on there.
I have a side bar and a content box


In side bar I have 5 links, say LINK1 - LINK2


In the content box, I have 3500px of width which contains 5 sections of
divs of 700px.
So the page initially loads in the first 700px div. So if I click on Link
3, it will smoothly scrolling to 3rd div section.


However, I would like to load the page in the 2nd div.
I was able to do this using scrollLeft()

<script>$("div.content1").scrollLeft(700);</script>


But the horizontal scrolling will be messed up. The second div will act as
first div, which means when I click LINK1, it won't be scrolled back.
Help?
*I think this code is needed

<script>
function goto(id, t){
//animate to the div id
$(".contentbox-wrapper").stop().animate({"left":
-($(id).position().left)}, 1200);
}
</script>

No comments:

Post a Comment