开发者

How to differentiate actual mouse clicks from script generated clicks?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜