让柔滑的选框在鼠标悬停/移出多个区域时停止/启动
我在页面上使用了丝滑选框,到目前为止效果很好,但我需要添加另一位:当我将鼠标悬停在滚动条上时停止选框,并在不悬停时重新启动选框的能力在它上面。
滚动条是 javascript:http://n-son.com/scripts/jsScrolling/。包含滚动条的 div 具有 Scrollbar-Track 类。这是我当前的版本:
http://www.palosverdes.com/sandbox/soverflow/index。 cfm
我尝试定制现有的 jquery 函数,但到目前为止我还没有运气。这是函数:
$('div.demo marquee').marquee('pointer').mouseover(function () {
$(this).trigger('stop');
}).mouseout(function () {
$(this).trigger('start');
}).mousemove(function (event) {
if ($(this).data('drag') == true) {
this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
}
}).mousedown(function (event) {
$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
}).mouseup(function () {
$(this).data('drag', false);
});
});
I'm using The Silky Smooth Marquee on my page and so far it's worked great, but I need to add another bit to it: the ability to stop the marquee when I'm hovering on the scrollbar, and start back up when not hovering on it.
The scrollbar is javascript: http://n-son.com/scripts/jsScrolling/. The div that contains the scrollbar has the class Scrollbar-Track. Here's my current version:
http://www.palosverdes.com/sandbox/soverflow/index.cfm
I've tried to tailor the existing jquery function but I've had no luck so far. Here's the function:
$('div.demo marquee').marquee('pointer').mouseover(function () {
$(this).trigger('stop');
}).mouseout(function () {
$(this).trigger('start');
}).mousemove(function (event) {
if ($(this).data('drag') == true) {
this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
}
}).mousedown(function (event) {
$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
}).mouseup(function () {
$(this).data('drag', false);
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将鼠标悬停/移出事件添加到滚动条,就像为侯爵添加鼠标悬停/移出事件一样。像这样的事情:
您触发事件的方式与侯爵本身的鼠标悬停事件相同,但您是通过滚动条的鼠标悬停/移出事件来执行的。
You can try adding mouseover/out events to the scrollbar just as you have for the marquis. Something like this:
You trigger the events the same way you do with the mouseover events for the marquis itself, but you do it from the scrollbar's mouseover/out events.