jQuery - scrollTop[ ] Method
Advertisements
Previous Page
Next Page
Description
The scrollTop[ ] method gets the scroll top offset of the first matched element.
This method works for both visible and hidden elements.
Syntax
Here is the simple syntax to use this method
selector.scrollTop[ ]Parameters
Here is the description of all the parameters used by this method
NA
Example
Following is a simple example a simple showing the usage of this method
Live Demo
The jQuery Example
$[document].ready[function[]{
$["div.demo"].scrollTop[ 200 ];
$["div.demo"].mousemove[function [] {
var top = $["div.demo"].scrollTop[];
$["#result"].html["top offset: " + top + "."];
}];
}];
div.demo {background:#CCCCCC none repeat scroll 0 0; border:3px
solid #666666; margin:5px; padding:5px; position:relative;
width:200px; height:100px; overflow:auto;}
div.result{margin:10px; width:100px; height:100px;
margin:5px; float:left; background-color:blue;}
p { margin:10px; padding:5px; border:2px solid #666;
width:1000px; height:1000px;}
Hello
This will produce following result
jquery-css.htm
Useful Video Courses
Video
JQuery Online Training
27 Lectures 1 hours
Mahesh Kumar
More Detail
Video
JQuery for Beginners
27 Lectures 1.5 hours
Pratik Singh
More Detail
Video
jQuery Masterclass Course: JavaScript and AJAX Coding Bible
72 Lectures 4.5 hours
Frahaan Hussain
More Detail
Video
Projects In JavaScript & JQuery
60 Lectures 9 hours
Eduonix Learning Solutions
More Detail
Video
jQuery for Beginner to Advanced: 12 Projects included
17 Lectures 2 hours
Sandip Bhattacharya
More Detail
Video
jQuery Memory Game Project - Fun coding Project with jQuery
12 Lectures 53 mins
Laurence Svekis
More Detail
Previous Page Print Page
Next Page
Advertisements