Question

Donec sed odio dui. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Cras justo odio, dapibus ac facilisis in, egestas eget quam.

Was it helpful?

Solution

OMG finally spotted what is the damn problem...

The scroll is not on the body or the html tag, it was on the wrapper...

Change the code like so:

$("a.scroll").click(function(event){
    event.preventDefault();
    $('.wrapper').animate({
        scrollTop:$(this.hash).offset().top - $('#header').outerHeight()
    }, 550);
})

OTHER TIPS

Drip code it's very good code! but if you have a "scrolls to random locations" like Joseph Bergdoll you must delete '#header'and make it empty. like this:

$("a.scroll").click(function(event){
    event.preventDefault();
    $('.wrapper').animate({
        scrollTop:$(this.hash).offset().top - $('').outerHeight()
    }, 550);
})

I just added an anchor <a id="Page1"></a> to the place i wont it then the code do scrolling to the position with $('body').animate not $('.wrapper') because my scroll is in body , This Code are tested in 2-JUN-2016 it's working 100% with Chrome and Fire fox [JQuery Loaded].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top