I have three links. I want each link to control a separate DIV (I guess within a container DIV). So when you open the page you have DIV-1, then you can click on the link for DIV-2 or 3 and the view will slide or scroll to that DIV.
How is this possible in jQuery? I’ve tried scrollleft to no avail.
Thanks in advance,
Stu
Use the .animate() method on the margins of the first Child-Cell.
Class “cell” consists of 200×200 boxes, all floated left. ID “container” is also 200×200, with an overflow of hidden. You could assign three links to animate the margin-left of the first div having the class “cell,” which would move all three left or right, depending on the amount you want.
Link1 -> First Div Margin Left = 0;
Link2 -> First Div Margin Left = -200;
Link3 -> First Div Margin Left = – 400;
Update: The following code has been updated in response to follow up questions within the comments.
I’ve enclosed the cells within another div. This div is within the container. Rather than manipulating the left-margin of the first cell, we’re going to manipulate the left-margin of the div that these cells reside within. Give this a shot – I’ve tried it and Got the desired results.