Jquery Image Rotater Snippet

There may be an easier way to do this - but given the following html:

<div class="rotate">
  <div><img /></div>
  <div><img /></div>
  <div><img /></div>
</div>

You can use the following code snippet to rotate through the images using jquery. You’ll need to set the rotate to be relatively positioned, and absolutely position the divs inside the .rotate div.

$(’div.rotate div’).hide().eq(1).show();
function rotate(){
var i = $(’div.rotate div:visible’).prevAll(’div’).length + 1;
i = i % $(’div.rotate div’).length;
$(’div.rotate div’).fadeOut().eq(i).fadeIn();
setTimeout(’rotate()’, 1000);
};
rotate();

Enjoy! Up with code snippets and down with unnecessary plugins!

One Response to “Jquery Image Rotater Snippet”

  1. KELLY Says:


    PillSpot.org. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. High quality pills. Buy drugs online

    Buy:Retin-A.Prednisolone.Arimidex.Prevacid.Human Growth Hormone.Zyban.Nexium.Petcam (Metacam) Oral Suspension.Synthroid.100% Pure Okinawan Coral Calcium.Valtrex.Actos.Lumigan.Zovirax.Accutane.Mega Hoodia….

Leave a Reply