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');
精彩评论