我使用 jQuery 在悬停 div
上滚动文本的代码:
HTML:
<div style="width: 390px; margin-left: 50px; background-color: #ddd;">
<div class="tooMuchWrapper"><span class="tooMuchText tooMuchText1">Got too much text to fit in your content area? Just hover for more more more more more more!</span></div>
</div>
JS:
$(function() {
$("#tooMuchText1").hoverForMore({
"speed": 300,
"loop": false
});
});
CSS:
.tooMuchText {
overflow: hidden;
white-space: nowrap;
display: block;
text-align: left;
text-overflow: ellipsis;
cursor: default;
}
但实际上我的代码不起作用。我使用 jQuery 2.2.0 进行测试。我该如何解决这个问题?
演示 JSFIDDLE
最佳答案
在你的 JSFIDDLE 中,删除第 275 行的 }... 更新版本:
$(function()
{
$(".tooMuchText1").hoverForMore({
"speed": 300,
"loop": false,
});
});
关于javascript - 悬停时的文本滚动不适用于 jQuery 2.2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41738138/