homepage Welcome to WebmasterWorld Guest from 107.22.141.14
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Function continually firing, run sub-function only once
ocon




msg:4493636
 6:46 am on Sep 11, 2012 (gmt 0)

I have a function that fires as an object is moved:

function objectMoving(c){
if(x==y) doThis();
doThat();
};

Among other stuff, I would like to run doThis if my x==y, but only once per move.

Unfortunately objectMoving continually fires as the object is grabbed, even if the object is not moving. I do not have access to when the object is let go.

Is there a way to run doThis only on the last run of objectMoving?

 

daveVk




msg:4494566
 3:11 am on Sep 13, 2012 (gmt 0)

Consider setting/reseting timeout each time, some time after last move, timeout will execute.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved