jquery - Give name to each looped div -
i have page show multiple images(cp-thumb) , when hover div contains information(cp-hover) show above image. show image directories looping.
so when when mouseover, hover effect show in divs not pointed div.
it because divs(cp-thumb) have same name since looped.
how give name of each div looping?
this how loop div:
$dir = dir("images"); while($filename=$dir->read())
div html/php:
<div class="cp-thumb"><div class="cp-hover" style="display: none;"> <div class="cphover-bg"></div> <div class="cphover-info"><p class="text11">03/09/2013 11:08 am</p> <p class="text10">#galaxy #nails</p></div></div> <img src="images/225cd24c144611e3b69022000a1deb4b_7.jpg" class="img_235x235"> </div>
jquery:
<script> $('.cp-thumb').hover(function () { $(this).children('.cp-hover').show(); },function () { $(this).children('.cp-hover').hide(); }); </script>
output:
Comments
Post a Comment