jquery------.cycle的使用
代码下载地址:http://malsup.github.io/jquery.cycle.all.js
把里面的代码复制到jquery.cycle.all.js里面
index.jsp
<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
<script type="text/javascript" src="js/my.js"></script>
<ul id="book"> <li><img title="A" src="addimage/2.jpg" width="300px" height="220px"></li> <li><img title="B" src="addimage/gaoda.jpg" width="300px" height="220px"></li> </ul>
my.js
$("#book").cycle({ timeout:2000, speed:200, pause:true }); var $book=$("#book"); var $control=$("<div id='bc'></div>"); $control.insertAfter($book); $("<button>pause</button>").click(function(event){ $book.cycle("pause"); }).appendTo($control); $("<button>resume</button>").click(function(event){ //$book.cycle("resume"); var $pause=$("ul:paused"); if($pause.length){ $pause.cycle("resume"); } else{ $(this).effect("pulsate",10); } }).appendTo($control);