Here’s a jQuery plugin that rotates through list items with a nice fade effect. You may nest any type of element you like inside a given list item.
Drop these scripts in your header:
<script src="js/jquery-1.4.1.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/jquery.quote_rotator.js" type="text/javascript" charset="utf-8"></script>
Call the function to any list element:
$(document).ready(function() { $('ul#quotes').quote_rotator(); });
You can specify which quote you’d like to show first by adding a class of active
to the list item. If you don’t explicitly add an active
class, it will default to the first item in the list.
$('ul#quotes').quote_rotator({ rotation_speed: 7000, // defaults to 5000 pause_on_hover: false, // defaults to true randomize_first_quote: true // defaults to false });
I’ve also built in a default to pause rotation on mouse hover. This is nice if you’re rotating through links or other elements that you might not want fading away from the user.