scroll to particular div position when click on link

scroll to particular div position when click on link javascript – If we now click on a specific link, we’ll immediately jump to the relevant page section.

scroll to particular div position when click on link

jQuery Scroll to Particular Div Position When Click on Link – Get the height of the element by .position().top property. The Scroll to Div functionality is very useful for single page website.

how can when click buton scrool to another elemtnt?

Read Also:  jquery Bootstrap Creating Tooltips Example

$("button").click(function() {
    $('html,body').animate({
        scrollTop: $(".greadDemo").offset().top},
        'slow');
});

scroll to specific div

$(window).scroll(function() {
    $('html, body').animate({
        scrollTop: $("#devContent").offset().top
    }, 2000);
});

scroll to particular div position when click on button

scroll to specific div

$(window).scroll(function() {
    $('html, body').animate({
        scrollTop: $("#devContent").offset().top
    }, 2000);
});

Don’t Miss : Trigger Function When DIV Enters Viewport In JQuery

How to scroll automatically to a particular element using JQuery?

<!DOCTYPE HTML>
<html>

<head>
	<title>
		How to scroll automatically to a particular element - www.pakainfo.com.
	</title>
	<style>
		#PAKA_DOWN {
			margin-top: 370px;
		}
	</style>
	<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
	</script>
</head>

<body style="text-align:center;">
	<h2 style="color:red;">
			Welcome To Pakainfo.com
		</h2>
	<p id="PAKA_UP"
	style="font-size: 15px;
			font-weight: bold;">
	</p>
	<button onclick="getData()">
		Click Here
	</button>
	<p id="PAKA_DOWN"
	style="color:red;
			font-size: 30px;
			font-weight: bold;">
		This is element.
	</p>
	<script>
		var el_up = document.getElementById("PAKA_UP");
		var el_down = document.getElementById("PAKA_DOWN");
		el_up.innerHTML = "scroll to particular div position when click on link.";
		function getData() {
			$(window).scrollTop($('#PAKA_DOWN').position().top);
		}
	</script>
</body>

</html>

I hope you get an idea about scroll to particular div position when click on link.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.