javascript - How to stop jQuery code block execution after first click -


i using jquery. every time clicking div associated class="panda", executing following code block. want execute first time click on div. code-

$(document).ready(function(){  $('.panda').click(function(){ $('.panda').sprite({fps: 10, no_of_frames: 4}); })  }) 

hope guys me.

use one:

$(document).ready(function(){     $('.panda').one('click', function(){         $('.panda').sprite({fps: 10, no_of_frames: 4});     }); }); 

from jquery documentation:

one(): attach handler event elements. handler executed @ once per element per event type.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -