KubeR Posted September 24, 2013 Share Posted September 24, 2013 Hi, I want to add a few checks to my website which will work all the time,I got all the code setted up. but the only problem is that I didn't find any event which runs all the time. I tried to use setInterval and setTimeout but setInterval didn't run the code and setTimeout works only once and don't repeat. So I wonder,is there any more/other ways to run a code in a loop per second or millisecond ? but won't affect the performance of the page(make it laggy/buggy and things) Thanks in advance for any kind of help, Greetings, KubeR. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/ Share on other sites More sharing options...
Maq Posted September 24, 2013 Share Posted September 24, 2013 What exactly are you trying to do? In jQuery you can bind events/methods. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451126 Share on other sites More sharing options...
KubeR Posted September 25, 2013 Author Share Posted September 25, 2013 To check distance between elements and move them forward or backward until the distance is exactly the distance which I set for it. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451184 Share on other sites More sharing options...
kicken Posted September 25, 2013 Share Posted September 25, 2013 setInterval (or a recursive setTimeout) is how you run something on a specific frequency. When you say it didn't work it's most likely you were just doing something wrong in your code, they both work fine. There may be a better way to do what you want, but we'd need more information detailing exactly what you want to do and how you want it done. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451224 Share on other sites More sharing options...
KubeR Posted September 26, 2013 Author Share Posted September 26, 2013 Well,the idea is like in YouTube,when you resize the page and the CSS moves to any place,jQuery(or maybe something else ? not sure) moves it back to the place it should be. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451238 Share on other sites More sharing options...
Solution trq Posted September 26, 2013 Solution Share Posted September 26, 2013 So you don't want to run the code "all the time", you want to attach it to a resize event. http://api.jquery.com/resize Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451248 Share on other sites More sharing options...
KubeR Posted September 26, 2013 Author Share Posted September 26, 2013 Never thought that Java can recognize resize. Anyhow,got an idea how to make the resize animation,thank you for helping me. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451251 Share on other sites More sharing options...
trq Posted September 26, 2013 Share Posted September 26, 2013 Never thought that Java can recognize resize. No one mentioned any Java. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451252 Share on other sites More sharing options...
KubeR Posted September 26, 2013 Author Share Posted September 26, 2013 Oh,I meant Javascript,not Java lol. Quote Link to comment https://forums.phpfreaks.com/topic/282428-jquery-event-that-works-all-the-time/#findComment-1451280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.