鼠标悬停时的原型阻止功能
我得到这个函数,可以每隔一段时间自动滚动轮播。
function startInterval() {
if (totSliders > 1) {
interval = setInterval("next()", 7000); }
setInterval("Time()", 1000);
}
window.onload = function {
startInterval()
}
我希望,当鼠标悬停一些“class ul li”元素(每个)时,函数 startInterval() 驱动器清除、停止。简而言之,当鼠标悬停在轮播元素上时,自动滚动就会停止。相反,在鼠标移出时,应重新启动相同的功能(以及自动滚动)。
我指出 setInterval("Time()", 1000);父函数中包含的函数不应在这些鼠标悬停/移出事件中考虑。它应该只被称为onload。
我怎样才能实现我的目标?多谢
I get this function that, on interval, make an auto-scroll of a carousel.
function startInterval() {
if (totSliders > 1) {
interval = setInterval("next()", 7000); }
setInterval("Time()", 1000);
}
window.onload = function {
startInterval()
}
I want that, on mouse over some "class ul li" elements (each), the function startInterval() drives cleared, stopped. In short, on mouse over the carousel elements, the auto-scroll stops. On mouse out, instead, the same function (and so the auto-scroll) should be restarted.
I point that setInterval("Time()", 1000); function that's included in the parent one, should not be considered in these mouse-over/out events. It should be called onload only.
How could I achieve my target? thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只是尝试一下这个问题,因为这个问题有点难以理解。根据我的猜测,您正在尝试将
onmouseover
和onmouseout
事件添加到所有class ul li
元素,对吗?如果是这样的话,你可以这样做:我肯定会对此进行错误测试,因为我确实没有这样做。
I'm just taking a stab at this one, because its somewhat hard to understand the question. From my guess, you're trying to add
onmouseover
andonmouseout
events to all of theclass ul li
elements, correct? If that's the case, here's how you do it:I'd definitely bug test this, cause I sure haven't.