jquery scroll to top

$("my-element").click(function () {
  $("html, body").animate({
    scrollTop: 0
  }, 1000)
})

3.33
2
Bist 110 points

                                    $('html, body').animate({
  scrollTop: $("#grepperRocks").offset().top
});

3.33 (3 Votes)
0
3
2
Pyro 100 points

                                    $('#DIV_ID').scrollTop(0);

3 (2 Votes)
0
3.86
7
Blod Mary 115 points

                                    // Get The Id
var topPage = document.getElementById(`top-page`)

// On Click, Scroll to the Top of Page
topPage.onclick = () => window.scrollTo({ top: 0, behavior: 'smooth' })

// On scroll, Show/Hide the button
window.onscroll = () => {
  window.scrollY > 500
    ? (topPage.style.display = 'block')
    : (topPage.style.display = 'none')
}

// CSS
body {
    background-color: #111;
    height:5000px;
}


#top-page {
  width: 50px;
  position: fixed;
  right: 30px;
  bottom: 30px;
  cursor: pointer;
  color: white;
  display: none;
}
// HTML
<img id="top-page" src="https://svgshare.com/i/LW3.sv" alt="Top">

3.86 (7 Votes)
0
3.67
9
Eniola 80 points

                                    window.scroll({
 top: 0, 
 left: 0, 
 behavior: 'smooth' 
});

3.67 (9 Votes)
0
4.29
7
Ambw 90 points

                                    window.scrollTo({top: 0, behavior: 'smooth'});

reference : https://stackoverflow.com/questions/15935318/smooth-scroll-to-top

4.29 (7 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 top using jquery click to scroll top jquery scroll back to top jquery go to top in jquery js move page to top scroll top event jquery document scroll to top javascript scroll to top by id jquery on click scroll to top body jquery jquery scroll to the top of the page on click on scroll to a div jquery jquery scroll to element\ jquery on click scroll to top jquery scrool to top to top page js section scroll top function in jquery scroll to elemet jquery scroll to top 0 jquery on click scroll top in jquery jquery scroll top page scroll to a section jquery scroll to top jquery method how to go to top of page javascript jquery scroll to element inside div scroll section to the top javascript javascript scroll to top' click scroll to div jquery scroll to the elem jquery scroll to top issue in jquery using jquery scroll to div jquery click to scroll top scroll to top appear on scroll jquery scrollTo jquery top how to scroll div to top using jquery jquery scroll to top scroll to an element using jquery scroll to a div section jquery js scroll to top page make website go to the top of the page with js how to scroll to a particular div in html using jquery jquery scrol to top javascript move top of page bring scroll to top javascript jump to top of page javascript scroll top to div jquery how to scroll to top of the page in jquery force scroll to top jquery scroll a div to top jquery javascript top of page javascript set top of page scroll to element using jquery jquery scroll top to the body html scroll to top and bottom jquery how to make page go to top in javascript on click scroll top jquery jquery scroll element to to goto top of page javascript scroll an element jquery scroll from bottom to top jquery scroll top of page using jquery scroll top of page jquery how to set scroll Top of element jquery move page to top in javascript jquer scroll to top scrol to top in jquery jquery scroll body top scroll to top in div jquery scroll to element with jquery return to the top of the page in js hscroll to top using jquery scroll to top using jquery move to top of page javascript js document scroll top jquery scroll-to-top scroll to top of ;page js jquery get scroll top element scroll to jquery javascript to top of page how to scroll to the top of a scrollbar jquery scroll to the very top javascript jquery scrolltop inside div jquery scroll t element how to scroll to top of page jquery scroll to top in jq scroll top jquery jquery page scroll top scroll to top with javascript on scroll to element jquery jquery scrollToElement how to scroll top to particular div using jquery scroll top from jquery link to section scroll to specific element in jquery jquery scroll to top on click scroll to particular div jquery auto scroll to top of div jquery scroll to div in jquery button scroll up to top jquery scroll up to top jquery scroll top page jquery jquery scroll to top slowly jqeury scroll to div scroll a element jquery jquery scroll to element swing jquery scroll to page element how to scroll in js to the top jquery scroll to top example jQuery scroll to eleemnt jquery scroll element top do something when scroll to a div jquery scroll to div jqeury scroll to top page jquery jquery to scroll to a specific element jquery scroll page to element jquery scroll page to div top jquery for scroll to a div scroll to the top javascript jquery scroll top of page js go top of page get scroll top value div jquery get scroll top div jquery obtain scroll top div jquery jquery auto scroll to top scroll to this jquery jquery scro to top move to top of the page js how to scroll page to top in jquery jquery force to scroll to top how to scroll to a div in jquery scroll top of the page javscript when page is scrolled to top js jquery scroll to the top of an element how to scroll to top of page javascript jquery javascript to not go top page top scroll window to top js jquery scroll to i scroll to to jquery how to scroll to top in js how to go to the top of the page in javascript jquery detect scroll to top of div how to scroll to the top of the page in javascript javascript scroll on top of page js scroll to the top scroll to top in javascript jquery scroll top inside div jquery scroll to top page go to top scroll jquery scroll into div jquery jquery window scroll top scroll to top of specific div jquery how to scroll top in javascript how to scroll top with javascript jquery set scroll position to top of div scroll to element on a page jquery scroll top div jquery scroll to section in jquery how to scroll to top in jquery scroll to top in jquery scroll to top in js scroll to div in jquery scrool to top jquery jquery click scroll to top scroll div to top jquery how to scroll to html element jquery scroll to div using jquery html go to top of page javascript jquery scroll to top button scroll to a div jquery jquery when scrolled to element back to top scroll jquery jquery scroll window to top jquery top scroll to top scroll jquery jquery page scroll goto top scroll to position jquery body scroll top jquery function body scroll top jquery jqury scroll to element jqury scroll to top scroll to top using js how to scroll to element in jquery jqeury scroll to element jquery scroll to element by # jquery trigger on scroll to element jquery scroll to top script jquery scroll to top of div on button click js scroll top of page scroll to top of page js scroll top top particular position in jquery scroll top in jquery dor css scroll top element jquery scroll top page javascript jquery scroll to top screen scroll top using jquery jquery scroll to element instantly javascript scroll page to top scroll to top jq jquery scroll element to top scroll to the top jquery jquery scroll to ujquery scroll to top of element scroll to top jquery plugin scroll element to div jquery javascript go to top page how to make page scroll to top in javascript return to top of page javascript scroll to particular div using jquery jqeury scroll to the top of the page jquery scroll to a certain element scroll to the top of the page with jquery scroll top and down jquery how to scroll page to top in javascript sjquery scroll a div to top how to scroll the page to top in javascript scroll to particular div in jquery scroll to using jquery js go to page top scroll screen to top javascript on scroll top jquery jquery and js scroll to element scroll to top of screen javascript java script scroll to top JQUERY scroll to eleme scroll to element jqyery how to scroll top in jquery scroll jquery to div click to scroll to div jquery jquery element scroll to top scrolling top element jquery jquery scroll to top of body scroll top jquery jquery scroll to a div scroll top injquery select Scroll to the top in jquery sjquery scroll top jquery click scroll to top of div scroll position top jquery jquery scroll to top of page scrolltoelement jquery jquery scroll page to top jquery scroll div to element scroll to html element jquery scroll down scroll top using jquery scroll to div element jquery jquery scroll position top jquery scroll = TOP window scroll to top jquery immediate scroll to top jquery Scroll to the top of a page with jQuery scroll to bottom jquery and scroll to top always scroll to top of the page js jquery go to top jquery scroll from top bottom to top scroll jquery jquery scroll to particular element jquery scroll Top to page jque scroll to element javascript go to the top of the page javascript move to top of page scroll to the top using js how to scroll body top jquery jquery jump to # jquery on scroll to top on scroll to div jquery jquery scroll to section scroll to element with id jquery jQuery ScrollTo - Smooth scroll to any jQuery/DOM element jquery scrollto a Div 700 height to scroll button show jquery scroll to top page js jquery scroll to elem js scroll to element how to get top of element in jquery jquery scroll to element onclick how to set scrollbar down to to in jquery scroll to top jquery button according div jquery how to scroll to the top in javascript jquery scroll postion scrollto to top scroll function jquery vanilla js scroll to div jquery jquery scroll bottom move scrollbar to top animate scrool jquery specofcicif div scrool on click jquery top - scroll to div jquery if scroll at top of div jquery jquery scrollto 0 0 swing jqury click scroll to top jumto element jquery scroll page up in javascript window scroll up jquery page up js scroll number jquery jquery as the page scrolls move an element from one posiotion to another jquery scroll.js jquery js scroll to the top website css javascript to page top jquery scrollto div how to find javascript on scroll top scroll to div html plugin scroll bar on top of the page html jquery start at top of page -scroll monitored scroll jquery active animate scroll jquery jquery to make a grid item on top on click scroll to top in div jqeury scroll event jquery jquery embeded elements scroll to top of the page scroll to very bottom jquery scroll to end jquery how to scroll at up of the page when click a button javascript onclick scroll to top scroll to top jquery smooth scroll to bottom of div jquery html move page up through js jquery slide to jquery smuth scroll jquery page scroll jquery scroll position scroll element jquery jquery scroll div to position jquery sroll to on click to element scroll jquery on click to to element scroll jquery scroll a div to top add scroll to top on load how to go to top of the page in js js to scroll to top jquery go to element jquery .js-scrollto jquery js-scrollto how to hold scroll while scrolling in jquery on click scroll to every 4th jquery node page scroll top page scroll top css scroll to specific element jquery set div overflow auto scroll jquery display a section when scroll to an element scroll to to javascript site scroll top how to sense scroll in jquery scroll to top of a div jquery jquery scroll to top of div animate css scroll to top of page scrolly jquery scrooll to top javascript how to scroll to top js how to scroll up innjs javascript move scroll to top make page scroll to top add scroll page jquery jqurry scroll to javascript is on top of page javascript take to top of page jquery animate body scroll to elment scroll to top link javascript go to top to top javascript scrollto element jquery scroll to goes to top of page how to scrolltop element with click js how to scrolltop with click js scroll page jquery click to scroll to top? js scroll top go to the top of page javascript goto top in css how to jump on page in html on clicking a button window scroll jquery javascript scroll up jquery move to top of div howto scroll to certain element with jquery jquery to scroll to an element scroll position in jquery go to top of div jquery scroll jquery top javascript page scroll to top javascript send to top of page scroll to bottom of a div jquery Scroll Up using jquery how to make a go to the top arrow html html go to top of page page scroll in jquery jquery scrolltop a container window.addEventListener("hashchange", function() { window.scrollTo(window.scrollX, window.scrollY +2500); }); scroll bottom jquery jquery get scroll position scroll end jquery jquery show new window and scroll top window scroll to jquery jquery div scroll to bottom smoothy when load get scroll position of div jquery set top of scroll ina box with jquery go to top of page html scroll up in html jquery scroll event js top off the page scroll to bottom in div jquery scroll to top of page on button click javascript jquery how to scroll to position scroll page top top javascript top buuton js jquery scroll tto id html for top of page how to make the go to top button after user scrolls to a div return to top of page onClick javascript scroll to div jquery scroll top in jquery jqueyr scroll to elet scrolltop jquery javascript return to top of page scrollTop() scroll to top of the page javascript jqvascript scroll to element by click scroll to element in jquery css3 click to scroll bottom jquery.scrolly jquery scrolltop scroll back to top html how to scroll page up with javascript on button click how to scroll page up with javascript add to top of html document js click button scroll javascript move page to top div scroll top jquery scroll to element css jquery scroll page to top on button click using javascript scroll page in click in javascript html back to top scroll scroll button js js how to go to top page scroll always top change page jqueyr scroll to jqueyr scrollto css scroll to top how to scroll on click jquery How to make an offset to the place of another element in the animation in jq page up in html js go top page scrolltop end jquery scroll to active element jquery scroll screen to specific div jquery web position scroll top jquery scroll to the top javascriptr scroll on top javascript jquery on click and scroll jquery animate scrolltop to element how to scroll to top of a page automatically using javascript get div position from top then animate scroll page to top on button click jquery get scroll position of div jquery scroll by javascrip click go top scroll to top after click javascript on click take to top of page get scroll position jquery scroll to top javscript scrolltop() in jquery get current scroll position jquery How do I move scroll to top? jquery how to scroll to top of page javascript how to scroll to top of page scroll to jqeury scroll to div exact jquery trasitnation property on bottom to top button using jquery javascript scroll top jquery how to make scroll back top happening on click js scroll up button jquery div scroll position bottom move to top using document scroll on top javascrip how to scroll top how to scroll up scroll top jqeury how to make scroll to top button button to scroll to top of page click button to scroll to top website button scroll down scroll page to top jquery jquery set scroll top html add a sliding go to top button button to scroll to add scroll to up html scroll to the top top javascript jquery scroll to item check if css top is auto jquery how to scroll to tio scrolltop how to set scroll position in jquery snap to top js scroll target jquery south scroll to an element jquery html button go top page add back to top to web page scrolls javascript scroll to top without jquery scrolling below element jquery html javascript scroll to top div scroll to top jquery how to get top screen scroll in js js page is on the top scroll top javascript scroll to elem scroll go to jquery begin at the top of the page jquery div scroll jquery on click scroll to top of page javascript to scroll to top of paeg back to top of page scroll to top of page back to top on page Button onClick makes page not jump to top of page in mobile view onclick top of page scroll page to top icon go top html from down page to top the page jquery scroll to div overf flow scroll to top button jquery plugin for selector jquery scroll to element top left jquery scroll div jquery scrolltop div jquery scroll to dov jquery scroll top scroll to the top js jquery scroll to bottom of div how to scroll to top of a page in javascript jquery scroll pont jquery how to scroll to element javascript how to jump to top of page how to use scroll top in jquery scroll to section jquery javascript page Top js scroll page up how to click and reach top of page in ktml move to the top of the page in javascript jquery window current scroll position jquery window scroll to current element jquery window scroll to element html onclick scroll to top jquery div scroll to bottom jQuery scrollTop stops before the element jquery animation scroll to element scroll to element in div jquery scroll up in js to the top html scroll to bottom jquery div scroll to top jquery div jquery custom link scroll to element on click go scroll to overflow div jquery jquery scroll of js scroll top page scroll to position jqyer+ get scroll in jquery browser get top scroll 0 javascript set scroll to top of page jquery scroll to div element scroll to top in main element jquery function scrolup jquery scroll in element css scroll to top of div animate scrol to element jquery scroll to top window javascript scroll to target jquery scroll to to[ scroll stops after scrolling down page with jquery jquery smooth scroll element with page scroll to position of element jquery scroll to element jquery animate js window scroll to top jq scroll jq scroll from current to bit jq scroll to element where data jq scroll to element jquery scroll smooth to element jquey scroll to scroll to with jquery land on page with top jquery juery scroll to element scroll is not reaching at the given id in jquery scroll to the every input field in jquery not working scroll to the every input field in jquery not wo javascritp jumper to top of window scroll to first option jquery focus element after hash url scroll jquery onclick to go to the top of the page JQUERY SCROLL TO # scrollto top window scroll position jquery if window scroll is 0 jquery scroll down jquery how to scroll to div and stop just before on click jquery scroll to element id jquery jquery make page scroll to top scrool to jquery js take you to top of page scroll to place on page jquery scroll to top of div jquery setting the scroll page to top in javascript jquery, scroll to element in div how to scroll to top in javascript return to top js scroll to top on click how to scroll to an element in jquery javascript jquery animate scroll to element javascript jquery animated scroll to element scroll to point on page html from button how to scroll up jquery javascript scroll to top function jquery 3.4.1 autoscroll jquery 3.4.1 autoscroll div jquery scroll to id element how to make a scroll up in js jquery scroll to element without id jquery scroll section to top of div onclick go on top jquery till specific class scroll window to element jquery move scroll target scroll to visible simple jquery jquery get window scroll position winto scroll up jquery jquery button smooth bottom id section jquery scrollto element scrolling too down auto scroll to top of page javascript how scroll top on page js scroll to element scroll to topc js back to top page html how to jquery scrollto element js scroll top top onclick button scroll to another place on page jquery scroll to el Scroll to the top of the page using JavaScript Scroll to the top of the page using JavaScript? jquery top of page jquery move to element jquery slide to element onclick auto scroll to to top of page jquery div scroll to top jquery scroll y value jquery animate scrolltop element jquery scroll top to element javascript scroll to the top how to press a button and autmatically scroll down to the another portion html css start top of page onclick javascript jquery scroll to top onlick scroll to first element button that scrolls to the top jquery scroll to element on button click jquery scroll to element js scroll to top of page on click jquery scroll to elelement how to scroll element with overflow: auto jquery jquery scroll down until element visible jquery scroll from top to a certen point jquery window trigger scroll top scroll up js jaquery scrollTop() similar js click on element to scroll jqudfy scroll to element jquery have element scrolled to the right on load send user to the top of the page javascript html css jump to the complete top jquery scroll to selected element input focus jquery animate croll bottom jquey scroll div HTML how top of the page animate scrolltop jquery of form Scroll to the element target js wndow load top of screen animate scrollTop to element of index jquery how to scroll to an n element jquery occlick scroll to the clas scroll to speacific element scroll to id in ty jquery scroll page jQuery scroll to this scroll value jquery get scrolled value using jquery how to scroll top to bottom on onclick in javascript how to take scroll on top of the page jquery scollto jquery scrolltop to element move page to top on Link scroll to the top of the page scrollto id button scroll down to element jquery ui scroll down jquery scroll as long as there is content jquery window.scrollto element how to bring on the top of page in html scroll to topin javascript jquery to scroll to top of page move screen to top on error in jquery jquery scroll to div animate finish scroll to tag jquery scroll to tag scroll to top jquery document scroll position jq js go to top jQuery(function () { jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 300) { jQuery('#back-top').fadeIn(); } else { onclick scroll jquery how to make body scroll to top in js jquery scroll to element add top of window set scroll for body yes jquery how to add a return to top button in html control scroll bar jquery use external variable in jquery scrolltop callback how to go on top of a page in html how to move to top of page in html on click jquery animate to target js when page is top window scroll to position jquery scroll to class on click jquery jquery scroll to top of element scrolling to paragraph jquery jquery scroll to element animate jquery scrolling div scroll top click jquery window scrolltop jquery scroll up in javascript page scrol up in javascript page jquery scrollto example jquery navigate to element jquery scroll to element with animation css to make scroll to top jquery scroll to element on route change html a top page javascript set page to top scroll to specific div inside child box jquery scroll to a section in jquery lib page goes on top in html how to scroll to a element in jquery scroll to the top of the page javascript jquery scroll page to top of element how to scroll to particular element using jquery back to top html with id jquery scroll div to top scroll top and bottom css javascript scroll to element in click scroll page on click jquery onclick go to top of page jquery scrool to element html scroll up to top of page jquery click scroll to element jquery ui scroll to element jquery scroll page select_sel go to top of page js jquery scroll to a element jquery scroll position within scrollable div jquery scroll within fixed scrollable div scroll to tope of page with javascript scroll to specific element jquery go scroll up automatically html on clik scroll to item jquery how to force div to scoll to top in jquery back to top button javascript smooth scrolling jquery move to element on page scroll item to the top of the current window jquery scroll window done poxels jquery scroll to top of html section automatically js scroll to top page javascript scroll down to element jquery jquery scroll to position window scroll to element jquery js scroll to top of page jquery detect current scroll position jquery scroll top top of div button click scroll to top jquery scroll to element by id jquery make page scroll jquery js go to top of page scroll to under element jquery different elements scroll to the top JQuery scroll to in jquery element scroll jquery index() to scroll up JQuery go to top trigger scroll jquery jquery on click event scroll to the class scroll to top of element jquery js goto top of page scroll page up javascript easy jquery move to element on click navigate and scroll using a tag jquery scroll to an elment jquery javascript to scroll to top of page go to the top of the page html jump to top of page html scroll up jquery jquery add scroll get info about window scroll position jquery jquery scroll up ajax scroll to top animation on click ajax animated scroll to top ajax animated scrolltop on button click ajax animated scrolltop button click to top up in html scroll ajax animate scroll to top of page on button click how to reach to the top of page with javascript jquery onclick button to return to top of page how to rebuild jquery scroll function scroll to top of page using jquery how to move browser view to dom element using jquery javascript jump to top of page animate scroll to element jquery jquery smooth scroll to element scroll the element to above in jquery navigate to top of page javascript window.scrollTo jquery jquery click or scroll scroll content 100px with jquery scroll div to top in jquery jquery scroll to scroll to position div jquery move user to top of div jquery how to scroll down to curtain point in jquery html onclick go to top of page jquery n click scrool to jquery animate to element jquery scroll to div position click on button add class and scroll down on next section without using overflow css jquery set scroll jquery scroll to eleent jquery scroll element js make element go down scroll to top to certain div jquery scroll page to top javascript javascript function to scroll to top of page back to scroll table top on jquery back to scroll div top on jquery jquery window scroll position how to use top of page in html js go up page j query scroll scroll up div jquery jquery move window to a particular class scrolltop to div jquery jquery scrollbar offset inner div jquery scroll to top of div scroll modal content to bottom ~jquery get document scroll position jquery onclick scroll to element jquery div scroll scroll to top of page html scroll on click jquery jquery detect scroll position page scrolls up when link clicked how to fix? move to top of the page scroll to top using javascript jquery scrollTop of element window.scrolltop jquery javascript slide to element go to # jquery clck go top of the page html jquery scroll to div position not in front view get scrolling value jquery javascript set page scroll to top how to scroll to top of page javascript jquery run script if you scroll to element scroll to item jquery page change on scroll jquery scroll to js jquery jquery scroll to element to top jquery scrollto scroll js jquery scoll to jquery how to go to the top of the page in html scroll based on click jquery scroll movement jquery javascript jquery scroll to element javascript scroll top of page where to write js code for scroll to top of page jquery scroll on top scroll top offset 200px jquery go to element jquery go to top jquery jquery scroll jquery scroll down appear jquery scroll to element in div how to go to top of the page in html javascript scroll to top of the page javascript go to top of page on click button scrolldown element jquery scroll to area jquery onclick scroll to top javascript click button scroll page jquery scrolling to div show in text jquery scroll to element jquery duration jquery smooth scroll to class when you scroll to the end of section force to beginning of new section jquery jquery scrollto element go to the top of the page javascript scroll to top of page javascript scroll to top js scroll to top of page jquery scroll to an element jquery scroll down to some jquery element jquery scroll content below element jquery content scroll below div jquery onclick scroll to element scroll up javascript jquery scrolltopoint scroll to top of page button click jquery animate body to div jquery js scroll to top go to top of page javascript scroll button down jquery srol to selector jquery jquery move page to element js go to top of scroll start on top of the page javascript jquery scroll selected item to top of window js jump to top of page make scrol with jquery jquery jump to element javascript scrol to top jquery scroll to element id scroll to jquery jquery scrolltop element move div on scroll element jquery jquery scroll to element on click jump to element jquery jquery scroll to element scroll to element on button click javascript jquery scroll to point javascript scroll to top of page jquery scroll to javascript scroll to top scrollTo jquery jquery animate scroll to element scroll to top javascript scroll to element jquery move page to top javascript window.scroll brings to top of page javascript javascript go to top of page
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