用于停止事件传播的jQuery UI滑块 [英] jQuery UI slider to stop event propagation
本文介绍了用于停止事件传播的jQuery UI滑块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在div中使用 jQuery UI Slider dragable。单击滑块时,事件会被传播,div开始拖动!有没有办法停止鼠标按下事件的传播?
I am using jQuery UI Slider in a div which is dragable. On clicking the slider, the event propogated and the div starts to drag! Is there a way to stop its propogation on the mouse down event?
使用return false对我不起作用。
Using return false doesn't work to me.
$('#slider-' + boxId).slider(
{
step: 0.2,
min: 0.2,
max: 2,
value: [1],
stop: function( event, ui )
{
var value = 0.2;
value = ui.value;
$('#' + boxId + ' .timeText').text(value + ' secs');
$('#' + boxId).attr('data-time' , value);
_timeLineUtility.reCalculateAll();
return false;
},
slide: function (event, ui)
{
return false;
},
start: function(event, ui) { return false; }
});
推荐答案
event.stopPropagation()
http://api.jquery.com/event.stopPropagation/
这是一个可能的副本 - 停止从点击处理程序传播mousedown / mouseup
Here is a possible duplicate - Stopping propagation of mousedown/mouseup from a click handler
这篇关于用于停止事件传播的jQuery UI滑块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文