Smooth Scroll to ID using jQuery

Today, We want to share with you Smooth Scroll to ID using jQuery.In this post we will show you Add smooth scrolling to page anchors, hear for Smoothly scroll to an element without a jQuery plugin we will give you demo and example for implement.In this post, we will learn about Animated scroll to anchor/id function with jQuery Script with an example.

Read Also:  C# Interview Questions And Answers

Smooth Scroll to ID using jQuery

There are the Following The simple About Smooth Scroll to ID using jQuery Full Information With Example and source code.

As I will cover this Post with live Working example to develop Jquery Smooth Scroll to a name and id, so the jquery scroll to element in div for this example is following below.

Animate page to id with jQuery


<a href="#about_us">About US</a>
<a href="#conatct_us">Contact Us</a>


<div id="about_us">About US</div>


<div id="conatct_us">Contact Us</a>


jQuery Part

$("a[href^='#']").click(function(e) {
	var position = $($(this).attr("href")).offset().top;

	$("body, html").animate({
		scrollTop: position
	} /* simple define a speed */ );

CSS Part

hr {
	height: 150vh;

Web Programming Tutorials Example with Demo

Read :

Read Also:  PHP Format File Size Convert KB MB GB


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Smooth Scroll to ID using jQuery.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  How to Retrieve Domain Name from URL in PHP?
  2. Read Also:  How to dynamically create a drop-down list with JavaScript and jQuery?
  3. Read Also:  Toggle Switch Button in VueJs Example
  4. Read Also:  VueJS Hello World First Application
  5. Read Also:  Dropdown Validation using Angular Example
  6. Read Also:  what is dbms and rdbms? : Difference between DBMS and RDBMS
  7. Read Also:  Create Animated Scroll To Top Button using jQuery
  8. Read Also:  Simple bootstrap responsive calendar Example
  9. Read Also:  Full form of Domain Name Extensions
  10. Read Also:  How to dynamically create a drop-down list with JavaScript and jQuery?