用光标滚动Div

时间:2012-09-12 22:02:23

标签: javascript jquery html scroll cursor

我一直在使用Scripterlative编写的一个名为CursorDivScroll的脚本,它根据光标位置滚动div的内容。在我的情况下,我想从div的右侧垂直滚动内容;不是一个连续的滚动,而是移动一点点然后停止,这样用户就可以控制。我在让脚本工作时遇到问题,并想知道是否有人知道更好的解决方案?我使用的脚本使用了cursordivscroll.js和这个脚本,它位于我的div下面。

 <script type='text/javascript' >
     $(document).ready(function() {
  CursorDivScroll( 'repertoiredetails', 40, 10 ).noHorizontal();
     });
 </script>

感谢您提前提供任何帮助。

 <div id="repertoiredetails">
 <p>content</p>
 </div><!-- close repertoiredetails-->

    #repertoiredetails {
background-color:#000;
width:400px;
opacity:0.7; filter:alpha(opacity=70);
    margin-top:140px;
float:left;
height:auto;    
    display:none;
    margin-left:-2px;
    padding-top:5px;
    border-radius:5px;
    -moz-border-radius:5px; /* Firefox 3.6 and earlier */
    z-index:999;
 }

 #repertoiredetails {
cursor: url(../images/arrow.png), auto;
    position:relative;

 }

 #repertoiredetails p {
  text-align:justify;
  text-justify:inter-word; 
  color:#999; 
  font-family:'Arial Narrow', Arial, sans-serif;
  font-size:13px;
  width:400px;
  padding:20px;
 }

1 个答案:

答案 0 :(得分:1)

不知道为什么noHorizontal()无法正常工作,但只要对CSS进行一些更改,就可以使其正常工作。

小提琴示例:http://jsfiddle.net/M4AXB/1/

祝你好运!