All TalkersCode Topics

Follow TalkersCode On Social Media

Scroll Down jQuery

Last Updated : Jul 1, 2023

Scroll Down jQuery

In this article we will show you the solution of scroll down jQuery, here we are going to achieves the result with the help of scrollTop() and height() methods.

The scrollTop() method sets or returns the vertical scrollbar position for the selected elements.

The height() function sets or returns the height of the selected element. It will returns the height of the FIRST matched element in html block.

Step By Step Guide On Scroll Down jQuery :-

Here we defined html block with h1 tag, empty pair of div tag and p element with indication message.

In script block we defined ready method which is help you to load script code when opening this program on browser.

Then document object generally points current document with the help of that we collecting accurate height().

And we passing that value to scrollTop() function, so it will points end of line when opening on browser.

<!DOCTYPE html>
        <title>SCROLL DOWN</title>
        <script src=""></script>
                width: 2rem;
                height: 80rem;
                background-color: aquamarine;
        <h1>Welcome All</h1>
        <p>You Reached Page End...</p>
  1. <!DOCTYPE html> tag which is instruct the web browser about what version of HTML file written in and it’s not have any ending tag.
  2. The<html> tag is used to indicate the beginning of HTML document.
  3. As above shown <head> tag is contain information about webpage and external file links are declared here. <title> tag is used for set the webpage title.
  4. Here we imported open source jquery library support file which is needed for coding using jquery in program.
  5. Both <head> and <title> tags having their pair end tag, so we need to close the ending tags respectively. If you’re not closed anyone of ending tag properly that is also affect the webpage result.
  6. <body> tag is beginning of main coding part because it contain coding of entire website blocks and elements described here.
  7. In script we defined ready method, there retrieving accurate height by document and height(). Then passing that value into scrollTop() function to reach end of page height.
  8. In style block we sets few style for div tag, such as width sets to ‘2rem’, height set to ‘80rem’ and background color set to ‘aquamarine’.
  9. In body block we defined h1 tag with text ‘Welcome All’-indicates staring line of page, div will replicate defined requirement on style block and p element text ‘You Reached Page End...’-indicates last line of page.
  10. Both </body>,</html> tags closed respectively. </body> tag indicates the end of body, Then </html> tag indicates the end of HTML document.

Conclusion :-

In conclusion now we are able to know how to get scroll down process using jquery.

Before execution of program we needs to confirm internet connection because then only that jquery file will supports defined jquery codes in document without any error.

When we executes this program on browser we can see rectangular bar with ‘You Reached Page End...’ message because it automatically points the end line of document.

You scroll top then you will get ‘Welcome All’ first message. I hope this article on helps you and the steps and method mentioned above are easy to follow and implement.

Latest Tutorials