Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

scroll up own

 
    // when click a btn page scroll  and go to home   
    $(window).scroll(function () {
        if ($(this).scrollTop() > 200) {
            $("#scroll-top").fadeIn(100)
        } else { $("#scroll-top").fadeOut()}
    })

    $("#scroll-top").click(function () {
        $("html,body").animate({ scrollTop: 0 }, "3000")
    })

// when click a link and go to section smoothly
// smooth scroll for all browser
	$('a').click(function (event) {
		if (this.hash !== '') {
			event.preventDefault();
			let hash = this.hash;
			$('html,body').animate({ scrollTop: $(hash).offset().top }, 800, function () {
				window.location.hash = hash;
			});
		}
	});
Comment

PREVIOUS NEXT
Code Example
Javascript :: await fetch parameters 
Javascript :: javascript /g 
Javascript :: npm jsonwebtoken 
Javascript :: add active in nav 
Javascript :: add object in array state react 
Javascript :: input show validation message 
Javascript :: mock callback function jest 
Javascript :: firebase get last document 
Javascript :: d3js.org 
Javascript :: javascript name convention 
Javascript :: moment iso string 
Javascript :: how to return json data from mvc controller to view 
Javascript :: javascript pop object from array 
Javascript :: methods javascript 
Javascript :: javascript documentation 
Javascript :: for loop on array in javascript 
Javascript :: create a customer in stripe node.js 
Javascript :: best javascript books 
Javascript :: get all form errors angular 
Javascript :: drag drop in blazor 
Javascript :: javascript export default 
Javascript :: delete request from the script to html 
Javascript :: round down js 
Javascript :: console.table in javascript 
Javascript :: check if computer online js 
Javascript :: Algorithm used by strapi for password 
Javascript :: what is package.json in node 
Javascript :: switch case statement in javascript 
Javascript :: summer note empty 
Javascript :: angular material dialog close pass data 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =