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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -