So I have the code:
function randomClick(interval){
$(".thumbnail_holder .nav li:not(.empty):eq("+select+") a").trigger("click");
window.randomTimer = setTimeout("randomClick("+interval+")", interval);
}
I need it so when a user click’s ".thumbnail_holder .nav li a, it clears the interval so for example
$(".thumbnail_holder .nav li a").on("click", function(e){
e.preventDefault();
clearTimeout(window.randomTimer);
});
However the above code also happens on the .trigger("click");.
Is there any way the .on function can differentiate between the two?
e.whichwill be undefined when the event is called bytrigger(), but will be1when you left click on it.Other option would be to pass some data when you trigger manually, and check for it in the event handler (see the
extraParametersargument intrigger().