scroll to specific div

<div class="first"><button type="button" onclick="smoothScroll(document.getElementById('second'))">Click Me!</button></div>
<div class="second" id="second">Hi</div>

4
6

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

4 (6 Votes)
0
4
4

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

// example: http://jsfiddle.net/ryXFt/3/

4 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to scroll to a particular div css scroll top to specific div scroll to specific div in js scroll to specific div onclcik scroll specific div how to scroll to specific div to specific position onclick scroll up div scroll on specific div html onclick scroll to div with id javascript scroll to specific div how to scroll to div on click How do I scroll to a specific div in HTML? scroll to a div on click scroll to particular div using js scroll to specific div scroll to specific div using id scroll to different div scrolling to a div onclick scroll page to specific div html on click scroll to div add scroll to specific div scroll to a particular div css scroll to certain div how to scroll a specific div scroll to particular div in html how to scroll div to specific postion on click scroll to div html how to scroll to a certain div scroll to other div scroll to certain div in the page onclick scroll to div css making a div scroll on click how to scroll to particular div in html scroll page on click jquery scroll to particular div css scrolltop to specific div scroll to target in button click in javascript how to scroll on specific div scroll to a specific point on button click javascript scroll down to div on click on click scroll to class scroliing down to specific section on click scroll to div scroll to specific element on button click scroll to div scroll in a div click and scroll to a specific div javascript click and scroll to a specific div on click scroll to specific div scroll to section javascript on click scroll to specific div in javascript scroll down to specific section scroll to element when clicked on scroll down div once onclick scroll to particular div position when click on link javascript scroll page page on specific element html jump to div on click javascript jquery scroll to section crolling to a particular section of the page. how to make smooth scrolling through the page when a button is clicked. javascript event listener scroll for specific div jump to specific div of page html scroll to specific part of page url button click scroll to div scroll div on click scroll to specific div javascript how to scroll to a particular div in html scroll to a specific div javascript js move down page to special part of html how to scroll to a particular div in html by click a button scroll down to section of page click to move scrollbar scroll down page to specific location on click javascript html onclick scroll to div javascript function click div as button link smooth js function click div as button link smooth scrool page on button click scroll to div on button click jquery scroll a specific div when scroll button clicked scroll a specific div how to scroll down to div when press on a tag on link click scroll to div scroll to a particular div how to scroll to a section in html how can when click buton scrool to another elemtn click and scroll to div scroll div on button click javascript on click of button to scroll down to another element on click scroll div on click div scroll down div js slowly scroll container on click scroll to div on non button element scroll to section on click smooth scroll to another page section onscroll on click scroll to that div javascript function button scroll container smooth scroll to specific div on click javascript scroll to particular div on click javascript on click scroll to div onclick scroll to scroll to div on click click scroll to div js scroll on click by element scroll to particular div position when click on button scroll to div on click html scroll to a div on button click how to scroll to another div button js scroll to element on click click on btn go to desired div html how to scroll to specific point on button click click to div smootly button click scroll down to div onclick scroll to div move to div on click how to scroll after button click in js scrollto div on click scroll to class on click js code to click and slide to section scroll to particualr section clicking a specific menu and scrolling down to specific section go to div on click html how to scroll to a particular section on click of a button in javascript html scroll to div on click click and scroll to div css css scroll to div on click onclick scroll to div javascript how to scroll up a div in html on button click onclick scroll to div html jquery click button to return to specific div on same page Javascript onclick scroll in div javascript scroll to element on click how to navigate to div on click css js scroll down onclick go to div on click click button jjump to div scroll to perticular section on click scroll to another section on button click scroll on button click on click scroll to div onclick move to particular div onclick jump to div scroll when click javascript scroll click html button click go to section javascript onclick scroll to div scroll to specific div
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source