Make The Css Positioning To Be Changed Only Once Onclick
Code : $(document).ready(function(){ $('#main_div').bind('click', function(e){ var x = event.pageX-document.getElementById('main_div').offsetLeft; var y = event.p
Solution 1:
An other way, maybe the more elegant one, would be firing the onclick handler only once using jQuery's .one() method. You would implement it as follows:
$("#main_div").one('click', function(e) {
//the rest of your code
});
Note that this saves you at least 4 lines of code!
Post a Comment for "Make The Css Positioning To Be Changed Only Once Onclick"