Jump to content


Photo

jQuery - Event that works all the time


Best Answer trq, 25 September 2013 - 10:59 PM

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

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • Age:17

Posted 24 September 2013 - 05: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

    Advanced Member

  • Moderators
  • 9,362 posts
  • LocationPennsylvania, USA

Posted 24 September 2013 - 05: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

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • Age:17

Posted 25 September 2013 - 12: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

    Wiser? Not exactly.

  • Gurus
  • 2,731 posts
  • LocationBonita, FL

Posted 25 September 2013 - 03: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.
Recycle your old CD's, don't trash them!
Did I help you out?  Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#5 KubeR

KubeR

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • Age:17

Posted 25 September 2013 - 08:19 PM

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

    Advanced Member

  • Administrators
  • 31,032 posts
  • LocationSydney, Australia.

Posted 25 September 2013 - 10:59 PM   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

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#7 KubeR

KubeR

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • Age:17

Posted 25 September 2013 - 11:13 PM

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

    Advanced Member

  • Administrators
  • 31,032 posts
  • LocationSydney, Australia.

Posted 25 September 2013 - 11:47 PM

Never thought that Java can recognize resize.


No one mentioned any Java.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#9 KubeR

KubeR

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • Age:17

Posted 26 September 2013 - 08:12 AM

Oh,I meant Javascript,not Java lol.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com