1 line
2.1 KiB
JSON
1 line
2.1 KiB
JSON
{"name":"scrollTop","type":"method","title":".scrollTop()","deprecated":null,"removed":null,"desc":"Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.","categories":["css","offset","manipulation/style-properties","version/1.2.6"],"entries":[{"return":"Integer","signatures":{"added":"1.2.6"},"examples":{"desc":"Get the scrollTop of a paragraph.","code":"\nvar p = $( \"p:first\" );\n$( \"p:last\" ).text( \"scrollTop:\" + p.scrollTop() );\n","css":"\n p {\n margin: 10px;\n padding: 5px;\n border: 2px solid #666;\n }\n","html":"\n<p>Hello</p><p></p>\n"},"desc":"Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element.","longdesc":"\n <p>The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be <code>0</code>.</p>\n "},{"return":"jQuery","signatures":{"added":"1.2.6","argument":{"desc":"An integer indicating the new position to set the scroll bar to.","name":"value","type":"Number"}},"examples":{"desc":"Set the scrollTop of a div.","code":"\n$( \"div.demo\" ).scrollTop( 300 );\n","css":"\n div.demo {\n background: #ccc none repeat scroll 0 0;\n border: 3px solid #666;\n margin: 5px;\n padding: 5px;\n position: relative;\n width: 200px;\n height: 100px;\n overflow: auto;\n }\n p {\n margin: 10px;\n padding: 5px;\n border: 2px solid #666;\n width: 1000px;\n height: 1000px;\n }\n","html":"\n<div class=\"demo\"><h1>lalala</h1><p>Hello</p></div>\n"},"desc":"Set the current vertical position of the scroll bar for each of the set of matched elements.","longdesc":"\n <p>The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. Setting the <code>scrollTop</code> positions the vertical scroll of each matched element.</p>\n "}]} |