开发者

How to differentiate actual mouse clicks from script generated clicks?

开发者 https://www.devze.com 2023-02-26 16:05 出处:网络
I have tabs.It has auto play. Take a look for example : http://jsfiddle.net/w3father/YEcZc/ How do I get click detail which su开发者_开发技巧ggests if it is a click from script?What I would generall

I have tabs.It has auto play.

Take a look for example : http://jsfiddle.net/w3father/YEcZc/

How do I get click detail which su开发者_开发技巧ggests if it is a click from script?


What I would generally do is use two different events but the same handler:

$('#tabs > a').bind('click auto-click', function(ev) {
  var wasRealClick = ev.type === "click";
  // ...
});

Then your timer-driven code should trigger "auto-click" instead of "click".

function cycle() {

    // simulate click on current tab
    $("#tabs > a").eq(currTab).trigger('auto-click');
0

精彩评论

暂无评论...
验证码 换一张
取 消