Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

scroll up link

 
    // 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 :: how to set asp radio button value to checked as per retrieve record in javascript 
Javascript :: how to find element in array angularjs 
Javascript :: min max value javascript 
Javascript :: add navbar active 
Javascript :: update object in array state react 
Javascript :: ordenar numeros array javascript 
Javascript :: html get input box value by element id 
Javascript :: add column sequelize 
Javascript :: d3.js 
Javascript :: make table responsive react-bootstrap-table2 
Javascript :: form contact 7 ajax send 
Javascript :: js how to find max value in an array 
Javascript :: javascript remove function from object 
Javascript :: adding methods to objects javascript 
Javascript :: lodash filter array objects 
Javascript :: how i do button when click open a new tab in react 
Javascript :: jquery select element with class 
Javascript :: How to replace an array vue.js 
Javascript :: js how to have an onclick inside of another onClick 
Javascript :: is checked jquery not working 
Javascript :: node js postgresql query 
Javascript :: create uuid to exist node neo4j 
Javascript :: round down html 
Javascript :: javascript traversing 
Javascript :: Replace symbol if it is preceded and followed by a word character js 
Javascript :: TypeError: fxn.call is not a function 
Javascript :: es6 closures 
Javascript :: changing photo with js 
Javascript :: leave page 
Javascript :: return js 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =