Slaythern Aareonna
Slaythern Aareonna

Reputation: 353

Fade in, fade out loop via jQuery

I have a img. E.G. enter image description here

I want some items fade out, fade in in loop on img. Is it possible jQuery?

Upvotes: 2

Views: 3615

Answers (2)

Danilo Radenovic
Danilo Radenovic

Reputation: 1029

You should add additional images over the existing one an fade them in and out. The code would look something like this:

    <img src='firstStar.jpg' alt='star image' id='firstStar' />

    var loopImages = function(){

         $('#firstStar').fadeIn(1500, function(){

                   $('#firstStar').fadeOut(1500, loopImages);           
         });
    }
    loopImages();

Other option might be placing transparent divs over the image and bluring them in a loop. For the later approach you can use blurjs library.

Upvotes: 3

Nikola
Nikola

Reputation: 15048

If you by "some items" refer to some items of the image itself - then the answer is no. But, if you have this image say as a background of some div then you could show some other elements on the image itself (by adding divs or imgs and positioning them accordingly) which would then be fade-in fade-out by jQuery.

Upvotes: 0

Related Questions