Jump to content


Photo

jQuery - Event that works all the time


Best Answer trq, 26 September 2013 - 03:59 AM

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 Go to the full post


  • Please log in to reply
8 replies to this topic

#1 KubeR

KubeR
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • Age:17

Posted 24 September 2013 - 10:05 PM

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.

#2 Maq

Maq
  • Administrators
  • Advanced Member
  • 9,410 posts
  • LocationPennsylvania, USA

Posted 24 September 2013 - 10:24 PM

What exactly are you trying to do? In jQuery you can bind events/methods.


tjmothy
ini_set ("display_errors", "1");
error_reporting(E_ALL);

#3 KubeR

KubeR
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • Age:17

Posted 25 September 2013 - 05:41 PM

To check distance between elements and move them forward or backward until the distance is exactly the distance which I set for it.

#4 kicken

kicken
  • Gurus
  • Wiser? Not exactly.
  • 3,317 posts
  • LocationBonita, FL

Posted 25 September 2013 - 08:58 PM

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.
Did I help you out? Feeling generous? I accept tips via Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7
Kicken's World⦄ ⦃Recycle old CD's

#5 KubeR

KubeR
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • Age:17

Posted 26 September 2013 - 01:19 AM

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.

#6 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 26 September 2013 - 03:59 AM   Best Answer

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

#7 KubeR

KubeR
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • Age:17

Posted 26 September 2013 - 04:13 AM

Never thought that Java can recognize resize.

Anyhow,got an idea how to make the resize animation,thank you for helping me.



#8 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 26 September 2013 - 04:47 AM

Never thought that Java can recognize resize.


No one mentioned any Java.

#9 KubeR

KubeR
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts
  • Age:17

Posted 26 September 2013 - 01:12 PM

Oh,I meant Javascript,not Java lol.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users