Search
 
SCRIPT & CODE EXAMPLE
 

CSS

smooth scroll to anchor

/* Just use Native HTML Smooth Scroll */
html {
  scroll-behavior: smooth;
}
Comment

smooth scroll on anchor tag

document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function (e) {
        e.preventDefault();

        document.querySelector(this.getAttribute('href')).scrollIntoView({
            behavior: 'smooth'
        });
    });
});
Comment

smooth scroll to anchor

jQuery(document).ready(function($) {
					var $page = $('html, body');
					$('a[href*="#"]').click(function() {
						$page.animate({
							scrollTop: $($.attr(this, 'href')).offset().top-50
						}, 600);
						return false;
					});
					});
Comment

PREVIOUS NEXT
Code Example
Css :: css text auto break line 
Css :: fixed image background css 
Css :: remove underline from hyperlink 
Css :: form field focus border remove css 
Css :: how to make text bold in css 
Css :: customize scrollbar 
Css :: css text vertical direction 
Css :: css center position absolute 
Css :: set scroll bar on a table 
Css :: no link underline css 
Css :: center div horizontally and vertically 
Css :: move to right css 
Css :: scroll-behavior not working 
Css :: css hover mouse hand 
Css :: css display none alternatives 
Css :: how to make image a circle css 
Css :: meta refresh only once 
Css :: inner box shadow 
Css :: sass calc with variable 
Css :: css smooth transition in and out 
Css :: linear-gradient(top to bottom) 
Css :: css ecken abrunden 
Css :: how to create a glass-polymorphism effect 
Css :: add background overlay over background image 
Css :: border radius not working 
Css :: js click under 
Css :: add alpha value to css color variable 
Css :: verticle line css 
Css :: css not last of type 
Css :: css display div horizontally 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =