Help a newb out? fadein/out

So I have this school project that I am making for my web dev final and I am using this jquery I found online. Being that this is not a javascript class we don't really learn about how javascript works but are able to use it on our finals.

Unfortunately I don't have enough time to learn it as of this semester being that it's almost over and was wondering if anyone would help me out with tweaking some of the code on this script so that the pulse is a lot slower.

As well I am wondering if there is any way to make the randomization stay random, it seems as though after a while the pulse will start organizing with other elements and pulse in unison.

here is the code the class that you use is called hot. (It's just what was used don't ask)

<script type="text/javascript"> $.fn.pulse = function(speed){ return this.each(function(){ var that= this setTimeout(function(){pulse.call(that)},Math.random()*1000) }).hover(stop,pulse) function pulse(){ $(this).animate({opacity:0},speed,function(){ $(this).animate({opacity:1},speed,pulse) }) } function stop(){ $(this).stop(false,false).css({opacity:1}) } } $(function(){ $('.hot').pulse('slow') }) </script>

Posted Nov 30, 2012, 5:10 PM UTC

15
PleaseTouchMeOP•

Here is some context as to how I am using it, I have a photogallery that I made myself that I applied the class to all the images. I was thinking I could get all of the images (30+ images) to fade in and out slowly, I am thinking that if the pulse was slower there would be less of a chance they start pulsing in unison.

1
PleaseTouchMeOP•

Heres a link to where I found it too

http://forum.jquery.com/topic/fade-in-and-out-in-a-loop

1
clodpated•

Do you have a working example up anywhere?

To slow down the randomization, replace the word 'slow' near the end of your script with the number of milliseconds you want it to take (make sure you remove the quotes, too).

For example, if you wanted it to take 1 second, the number would be 1000. If you want it to take 5 seconds, change it to 5000.

I'd need to see a working copy to get a better understanding of the second part of your request.

1
PleaseTouchMeOP•

I dont have an example being that everything is local, I will try this out and let you know what happens.

1
PleaseTouchMeOP•

Looks like that works well thanks abunch, any idea on how I can make them more random? For example after a while the images I am using will start pulsing at the same time. Thanks so much.

1
[deleted]•

[deleted]

1