Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Jquery Scroll on div using anchor tag is not Working properly

$(document).ready(function(){
    $("a").on('click', function(event) {
        if (this.hash !== "") {
            event.preventDefault();
            var hash = this.hash;
            $('html, body').animate({
                scrollTop: $(hash).offset().top
            }, 800, function(){
                window.location.hash = hash;
            });
        }
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: regex cpf javascript 
Javascript :: javascript prepend element to array 
Javascript :: scrollview child layout ( justifycontent ) must be applied through the contentcontainerstyle prop 
Javascript :: localstorage read all key 
Javascript :: get distance of element from top of page javascript 
Javascript :: Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. 
Javascript :: return value from fetch javascript 
Javascript :: update cypress 
Javascript :: javascript add adjacent html 
Javascript :: jest expect href 
Javascript :: joi email validation regex 
Javascript :: This version of CLI is only compatible with Angular versions 0.0.0 || ^10.0.0-beta || =10.0.0 <11.0.0, but Angular version 9.1.3 was found instead. 
Javascript :: how to check if a number is float javascript 
Javascript :: how to filter array objesct in express node js 
Javascript :: foreach selector in jquery 
Javascript :: js add week to date 
Javascript :: moment js day name language 
Javascript :: add 1 year to current date javascript 
Javascript :: load script js 
Javascript :: javascript number to words 
Javascript :: angular date formats 
Javascript :: how to get today date in javascript 
Javascript :: how to select all elements of type js 
Javascript :: perfect scrollbar in textarea angular 
Javascript :: GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead 
Javascript :: jquery check if element has child 
Javascript :: jquery set title 
Javascript :: how to set header in angular 8post 
Javascript :: javascript for...in with Strings 
Javascript :: nodejs remove unsafe string 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =