user3172050
user3172050

Reputation: 839

How can I make a menu that makes the browser window slide to a div?

Ok, so here is the effect I am attempting to emulate:

http://www.lukestevenson.me/

http://sohacks.com/

Notice how when a menu item is clicked on, the menu slides to the appropriate div. How can I do this with my menu? My website is at willowlake.github.io .

Thanks.

EDIT : Thanks guys! Don't waste any more of your time on this simpleton question, it has been answered in depth.

Upvotes: 0

Views: 89

Answers (3)

Green Wizard
Green Wizard

Reputation: 3667

Add this to your script and you will be able to get the effect.

$('#idOfYourMenuItem').click(function(){
    $('html, body').animate({ scrollTop: $('#idOfYourDiv').offset().top });
});

Upvotes: 0

Mamun Sardar
Mamun Sardar

Reputation: 2729

Take a look at this:

How can I make a DIV slide in and out?

Upvotes: 1

Sridhar R
Sridhar R

Reputation: 20418

Use this

Tiny Scrolling is a small script dedicated to support the navigation between the internal links and their destinations. It replace that annoying and confusing jump from various part of a page with a smooth scroll of the page itself.

Download the script (.js)

Tiny Scrolling

Upvotes: 1

Related Questions