0

I am new in the world of web development so excuse my ignorance in some points :p

Anyone can tell how jump links work? And how to implement them?

Let me make a specific example, I want to create a website with an horizontal bar, I saw some modern sites that those links doesn't change the page, they just jump down to another section and if I scroll up, I end up on home again.

How can I implement this and does it work with bootstap?

Thanks

b1sgas
  • 1
  • 1
  • 1
    Its all Javasript. it should work with bootstrap as well. check this out: http://stackoverflow.com/questions/15991356/jquery-scroll-to-section-of-page – CodeGodie Feb 20 '15 at 14:54
  • 1
    Possible duplicate: http://stackoverflow.com/questions/6677035/jquery-scroll-to-element – CodeGodie Feb 20 '15 at 14:58
  • possible duplicate of [Go to #div box JavaScript](http://stackoverflow.com/questions/2255388/go-to-div-box-javascript) – Artjom B. Feb 20 '15 at 16:30
  • I think he might be looking for something more similar to [fullPage.js](http://alvarotrigo.com/fullPage/) plugin. – Alvaro Feb 26 '15 at 13:15

2 Answers2

1

That, my friend, is a single page website, they are not jump links, you are only using jquery to scroll down to the content on click.

Here is an example of a code that will do just that :

$(function() {
    $("#abc").bind("click", function() {
        $("html, body").animate({
            scrollTop: $("#anchor").offset().top
        }, 500);
    });
})(jQuery);

When you click on an element with an id of abc it will take you to the top of the #anchor id element, no matter where on the page it is found.

Also, here is an example using this exact code : jsfiddle

Alin
  • 1,038
  • 3
  • 19
  • 43
0
<a href="#title1">Go to title1</a>
<a href="#title2">Go to title2</a>


/* Lots of space */

<a name="title1">Title 1</a>

/* Lots of space */

<a name="title2">Title 2</a>
Austin Collins
  • 431
  • 3
  • 13