我试图让 div 中的文本垂直自动滚动(以一种速度)并在用户将光标悬停在它上面时暂停,但似乎无法让我的代码正常工作。我怎样才能实现这一目标?到目前为止,这是我的代码:
JavaScript
$('#scroll').children().animate({'margin-top': '-=' + ($('#scroll').children().height()-100)}, 10000);
HTML
<div id="scroll">Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here<br />
<br />
Content here and more content here </div>
另外,我也在这里上传了我的代码:http: //jsfiddle.net/5DmZh/。