control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/scrollLeft.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
2.3 KiB
JSON

{"name":"scrollLeft","type":"method","title":".scrollLeft()","deprecated":null,"removed":null,"desc":"Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal 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 scrollLeft of a paragraph.","code":"\nvar p = $( \"p:first\" );\n$( \"p:last\" ).text( \"scrollLeft:\" + p.scrollLeft() );\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 horizontal position of the scroll bar for the first element in the set of matched elements.","longdesc":"\n <p>The horizontal scroll position is the same as the number of pixels that are hidden from view to the left of the scrollable area. If the scroll bar is at the very left, or if the element is not scrollable, this number will be <code>0</code>.</p>\n <div class=\"warning\">\n <p><strong>Note:</strong><code>.scrollLeft()</code>, when called directly or animated as a property using <code>.animate()</code>, will not work if the element it is being applied to is hidden.</p>\n </div>\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 scrollLeft of a div.","code":"\n$( \"div.demo\" ).scrollLeft( 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 horizontal position of the scroll bar for each of the set of matched elements.","longdesc":"\n <p>The horizontal scroll position is the same as the number of pixels that are hidden from view above the scrollable area. Setting the <code>scrollLeft</code> positions the horizontal scroll of each matched element.</p>\n "}]}