scroll
English [skrəʊl] American [skroʊl]
n. (Commonly used for recording official documents) paper scroll; scroll, picture scroll, scroll; scroll (decoration);
vt. Make it scroll; (on a computer screen) move from top to bottom (information, etc.), roll pages
vi . (like a scroll) to roll up; (like to unroll a scroll) to display text on the screen
left
英[left] 美[lɛft]
adj.Left, left; leftist
n.Left, left;[military] left wing;left wing, radical
adv.To the left; on the left
v.Leave (past tense and past participle of leave)
jquery scrollLeft() method syntax
Function: scrollLeft() method returns or sets the horizontal position of the scroll bar of the matching element. The horizontal position of a scroll bar is the number of pixels scrolled from its left side. When the scroll bar is at the far left, the position is 0.
Return the horizontal scroll bar position: Return the horizontal scroll bar position of the first matching element.
Syntax: $(selector).scrollLeft()
Set the horizontal scroll bar position: Set the horizontal scrolling of all matching elements bar position.
Syntax: $(selector).scrollLeft(position)
Parameters:
Parameter | Description |
position | Optional. Specifies the new position in pixels. |
jquery scrollLeft() method example
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("div").scrollLeft(100); }); }); </script> </head> <body> <div style="border:1px solid black;width:100px;height:130px;overflow:auto"> The longest word in the english dictionary is: pneumonoultramicroscopicsilicovolcanoconiosis. </div> <button class="btn1">把滚动条的水平位置设置为 100px</button> </body> </html>
Click the "Run instance" button to view the online instance