2014-01-26 50 views
0

如何更改选择器事件处理程序? 函数refreshThreshold()更改三次鼠标点击的频率。事件处理程序中的更改选择器

我的代码不起作用。更准确地说,通过改变变量“thresholdVal”不会改变点击的频率(“threshold:thresholdVal”选择器)。

从这里采取处理脚本tripleclick: https://github.com/richadams/jquery-tripleclick

function refreshThreshold() { 
    thresholdVal = $("#trippleclickSlider").slider("value"); 
    console.log(thresholdVal); 
} 

var thresholdVal = 1000; 
$("#div").on("tripleclick", { threshold: thresholdVal }, function() 
{ 
//any process 
}); 
+0

锁定。提示查看脚本三次点击。忘记指定数据。 – user3079091

回答

0

这听起来好像上tripleclick监听器只存储值而不是引用变量。

试着改变你的refreshThreshold()函数来另外重新设置监听器(再调用div.ontripleclick)

我希望这有助于。

+0

我试图使用.off()和.unbind()来重置侦听器,但只有一个错误:“Uncaught ReferenceError:data is not defined”。链接到trippleclick脚本。这意味着需要改进脚本本身?还是有另一种方式? – user3079091

+1

感谢您的帮助! 该代码是一个错误,所以不可能做.off() – user3079091

相关问题