Jquery click: how to check if the button is clicked or not clicked?

You can stop a timeout from being executed the next time by using clearTimeout(), passing the setTimeout() handler as a parameter.

Up vote 0 down vote favorite share g+ share fb share tw.

For instance, this timer in my plugin will be triggered if the previous button is not clicked, but I don't want to run this timer code when the button is clicked. $.fn. Run_slide.

Timer_each = setTimeout(function() { $.fn. Run_slide. Loop_slide(object); },o.

TimerEach); This timer code is inside this chunk of code, next. Css({opacity: 0.0}). AddClass('active').

Animate({opacity: 1.0}, o. TimerTransition, function(){ current. Animate({opacity: 0.0}, o.

TimerTransition). RemoveClass('active last-active'); $.fn. Run_slide.

Timer_each = setTimeout(function() { $.fn. Run_slide. Loop_slide(object); },o.

TimerEach); }); I was thinking to do something like this but I think it is not the right method, if(!button_previous. Click) { $.fn. Run_slide.

Timer_each = setTimeout(function() { $.fn. Run_slide. Loop_slide(object); },o.

TimerEach); } Any ideas? Thanks. Edit: found the problem in my code and this is my solution: // Check if the next button or previous button is not clicked then fade the current slide.

If(!button_previous. Click) current. Animate({opacity: 0.0}, o.

TimerTransition). RemoveClass('active last-active'); jquery jquery-plugins click onclick link|improve this question edited Jun 21 '11 at 15:54 asked Jun 21 '11 at 15:41lauthiamkok2,5111550 87% accept rate.

You can stop a timeout from being executed the next time by using clearTimeout(), passing the setTimeout() handler as a parameter. Should be something like this clearTimeout( $.fn. Run_slide.

Timer_each ); But I'm not sure if you sticked the setTimeout handler in a good position.

Thanks. My timer is fired after the animate function and the click function could happen before, or after, or in-between the time of animate. But I think I found the problem and fixed it in my edit.

– lauthiamkok Jun 21 '11 at 15:56 you could also set a variable or add a class (or a data) to the button when this gets clicked... and when the timeout function gets executed, check if the button has that particular class/data or what that variable value is, and stop the function with a return statement for example. – Jose Faeti Jun 21 '11 at 16:06 thank you. This is a good trick!

– lauthiamkok Jun 21 '11 at 17:51.

Use clearTimeout, as demonstrated in this fiddle.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions