Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 249155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:24:11+00:00 2026-05-11T21:24:11+00:00

I have three links. I want each link to control a separate DIV (I

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:24:11+00:00Added an answer on May 11, 2026 at 9:24 pm

    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.

    <style type="text/css">
      div#container { width:200px;height:200px;overflow:hidden; }
      div.cells { width:600px;height:200px;}
      div.cell { float:left;width:200px;height:200px;margin:0;padding:0; }
      div.cell p {margin:0;padding:0;}
    </style>
    
    <ul>
      <li><a href="#" class="box-mover">Show Box 1</a></li>
      <li><a href="#" class="box-mover">Show Box 2</a></li>
      <li><a href="#" class="box-mover">Show Box 3</a></li>
    </ul>
    
    <div id="container">
      <div class="cells">
        <div class="cell" style="background:#f1f1f1;">
          <p>Cell 1</p>
        </div>
        <div class="cell" style="background:#cc0000;color:#ffffff;">
          <p>Cell 2</p>
        </div>
        <div class="cell" style="background:#f1f1f1;">
          <p>Cell 3</p>
        </div>
      </div>
    </div>
    
    <script type="text/javascript">
      $(document).ready(function(){
    
        $("a.box-mover:eq(0)").click(function(event){
          event.preventDefault();
          $("div.cells").animate({"marginLeft": "0px"}, "slow");
        });
        $("a.box-mover:eq(1)").click(function(event){
          event.preventDefault();
          $("div.cells").animate({"marginLeft": "-200px"}, "slow");
        });
        $("a.box-mover:eq(2)").click(function(event){
          event.preventDefault();
          $("div.cells").animate({"marginLeft": "-400px"}, "slow");
        });
    
      });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my scenario: I have a page containing several links; each link is meant
I have an index page with three links as follws. When I click the
I have a page which essentially looks like this: <div id=foo> <a>One</a>, <a>Two</a>, <a>Three</a>,
I have three images and 1 imageview , i want to show each image
I have the following three tables. I am trying to inter link (join) among
I have a table which needs to link one of three seperate tables, but
On this page there is a list of footer links that have a little
i have a master page with three sections, left pane + 2 right panes
I have a navigation container with vertically ordered links inside. What I would like
I have read this article (Link: http://guides.beanstalkapp.com/version-control/branching-best-practices.html ) that gives some good best practice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.