Jquery - 使用DIV滚动DIV(overflow:auto;)

时间:2011-02-09 20:37:42

标签: jquery scroll overflow


如何用DIV滚动DIV(overflow:auto;)?

HTML

<div style="width:100px; height:200px; border:1px solid #ff0000; overflow:hidden;">
   <div id="my_div" style="width:100%; padding-right:20px; height:100%; overflow:auto;" class="sph">
       <div style=" background-color:#c6c6c6; width:10px; height:20px; position: absolute; left:80px; cursor:pointer;" >S</div>
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />
       .. content ...  <br />       .. content ...  <br />       .. content ...  <br />       
   </div>

</div>

<br /><br >
  Use the MouseScroll to scroll or use the [S]croll Div

示例 http://jsfiddle.net/sbAfW/11/

提前致谢!
彼得

1 个答案:

答案 0 :(得分:3)

查看jScrollPane plugin

the demo page上的第一个演示是你可能正在寻找的。您可以从jspVerticalBar和jspTrack类中删除背景属性,然后就可以了!