Hi,
I am trying to create a css-based horizontal div scroller (a div that allows user to scroll the content left and right).
Here's what I have:
This scroller works fine, but here's my problem: say a user scrolls to the right, and sees an item that she likes. She clicks on it and is taken to the page for that item. I would like to save in a cookie the position of the scroller (how far to the right she has scrolled to just before exiting the page), so that when she returns to the page, she will be taken back to where she was.
My question is what element controls how far to the right she has scrolled to? Say she has scrolled 200px to the right, when she returns to the page what element shall I set to 200px in order to return her to her last position?
I would have thought, it should be the left=-200px in #content, but it doesn't work for me. Any suggestion?
Regards,
Min
I am trying to create a css-based horizontal div scroller (a div that allows user to scroll the content left and right).
Here's what I have:
Code:
#window{
position:relative;
border:solid 2px;
width:760px;
height:330px;
}
#windowscroll{
top:0px;
left:0px;
margin:0;
padding:0;
overflow:auto;
}
#content{
margin:0;
padding:0;
}
<div id="window">
<div id="windowscroll">
<div id="content">
Item1...Item2...Item3...Item4 ...
</div>
</div>
</div>
This scroller works fine, but here's my problem: say a user scrolls to the right, and sees an item that she likes. She clicks on it and is taken to the page for that item. I would like to save in a cookie the position of the scroller (how far to the right she has scrolled to just before exiting the page), so that when she returns to the page, she will be taken back to where she was.
My question is what element controls how far to the right she has scrolled to? Say she has scrolled 200px to the right, when she returns to the page what element shall I set to 200px in order to return her to her last position?
I would have thought, it should be the left=-200px in #content, but it doesn't work for me. Any suggestion?
Regards,
Min