Solved

JQuery Slide Effect on Anchor Click

Posted on 2011-02-20
3
1,055 Views
Last Modified: 2012-05-11
Hi all,

I have some html DIV's (sections)...

What I want to do is using JQuery I want to slide (effect) from one to the other..

Example:

<div id="div-1">
Some text here
Some Text here
<a href="#div-2">Goto div-2</a> <!--When I click on this link I need it to Slider (horizontally to div-2-->
</div>

<div id="div-2">
Some other text here
Some other Text here
</div>


<div>

Hope someone can help

Thanks

0
Comment
Question by:error77
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 34938217
     $(document).ready(function() {
        $('#div-1 span').click(function() {
          var $lefty = $("#div-2");
          $lefty.animate({
            left: -$lefty.outerWidth()
          });
        });
      });


<div id="div-1">
Some text here
Some Text here
<span>Goto div-2</span>
</div>
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34938219
0
 

Author Closing Comment

by:error77
ID: 34938982
THanks a million :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Any Way to rotate banner ads from Commission Junction? 2 37
Rotate images for Web Page 11 28
arrays and radio buttons 10 40
Building JSON/JQuery Results Display 11 27
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question