jQuery CSS 操作 - scrollLeft() 方法
来源:互联网 发布:淘宝店技巧 编辑:程序博客网 时间:2024/06/05 11:55
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.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>
CSS 属性 描述 css()设置或返回匹配元素的样式属性。height()设置或返回匹配元素的高度。offset()返回第一个匹配元素相对于文档的位置。offsetParent()返回最近的定位祖先元素。position()返回第一个匹配元素相对于父元素的位置。scrollLeft()设置或返回匹配元素相对滚动条左侧的偏移。scrollTop()设置或返回匹配元素相对滚动条顶部的偏移。width()设置或返回匹配元素的宽度。
<head>
<script type="text/javascript" src="/jquery/jquery.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>
其实,就是设置滚动条的位置嘛
列出的这些方法设置或返回元素的 CSS 相关属性。
0 0
- jQuery CSS 操作 - scrollLeft() 方法
- jQuery css方法操作
- jQuery CSS 操作 - css() 方法
- jQuery CSS 操作 - css() 方法
- jQuery CSS 操作 - css() 方法
- jQuery CSS 操作 - offset() 方法
- jQuery CSS 操作 - height() 方法
- jQuery CSS 操作 - offsetParent() 方法
- jQuery CSS 操作 - position() 方法
- jQuery CSS 操作 - position() 方法
- JQuery中操作Css样式的方法
- JQuery中操作Css样式的方法
- JQuery中操作Css样式的方法
- JQuery中操作Css样式的方法
- jQuery修改操作css属性实现方法
- jQuery操作CSS属性的相关方法
- jQuery修改操作css属性实现方法
- jQuery修改操作css属性实现方法
- Android App的基本原理
- HDU 2196 Computer
- light1260Race Track【点到线段最短距离】
- 单点登录----->cas实现单点登录
- raw和assets的区别
- jQuery CSS 操作 - scrollLeft() 方法
- KBEngine
- c++ primer学习笔记4_复合类型续
- Same Tree
- UVa 10129 - Play on Words
- svn与eclipse进行整合开发
- 前端框架【Bootstrap】框架体验评测
- *LeetCode-Binary Tree Maximum Path Sum
- Unity报错:Collection was modified; enumeration operation may not execute