css - jQuery pulse effect issue -


i'm trying pulse effect on image. in this fiddle, hope light purple border fading in , out around red circle. red circle should remain static. can both of them fade in , out, not purple border. ideas, please?

html

<div id="pulsediv">   <div class="imgnopulse"><img src="http://ubuntuone.com/1djvfylv62orxb8gssa4r4">     <div class="imgpulse"><img src="http://ubuntuone.com/2duahohinz7letkwlsipm5"></div> </div>   

css

.imgnopulse { position:absolute;left:15px;top:15px;z-index:1; } .imgpulse { position:absolute;left:-15px;top:-15px;z-index:-1; } 

javascript

  function fadethemin(){         $('#pulsediv').children('div').delay(400).fadein('slow',function(){fadethemout();});   };   function fadethemout(){         $('#pulsediv').children('div').delay(400).fadeout('slow',function(){fadethemin();});   };   $(document).ready(function(){         fadethemin();   }); 

change:

$('#pulsediv').children('div') 

to:

$('#pulsediv').find('div.imgpulse') 

jsfiddle example

.children() traverses down 1 level in dom while .find() dig down multiple levels. wanted specify .imgpulse div, not divs.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -