<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
??? <title></title>
??? <script type="text/javascript" src="jquery-1.2.6-vsdoc-cn.js"></script>
??? <style type="text/css">
??????? img{ width:100px; height:100px; }
??????? a.current{ color:#f00;}
??? </style>
??? <script type="text/javascript">
??????? (function ($) {
??????????? var defaults = {
??????????????? speed: 3000,
??????????????? frist: 0,
??????????????? auto: 1
??????????? };
??????????? $.fn.extend({
??????????????? slideshowpic: function (options) {
??????????????????? var slidedata = $.extend({}, defaults, options);
??????????????????? slidedata.slidepicbox = this;
??????????????????? $(document).ready(function () {
??????????????????????? picplay(slidedata.frist, slidedata);
??????????????????????? if (slidedata.slidebtnbox) {
??????????????????????????? slidebtn = slidedata.slidebtnbox.children();
??????????????????????????? slidebtn.each(function (i) {
??????????????????????????????? $(this).bind("click", function () {
??????????????????????????????????? //alert(i);
??????????????????????????????????? if (slidedata.auto) { clearTimeout(slidedata.autotime); }
??????????????????????????????????? picplay(i, slidedata);
??????????????????????????????? });
??????????????????????????? });
??????????????????????? }
??????????????????? });
??????????????? }
??????????? });
??????????? picplay = function (num, mydata) {
??????????????? var slidepic = mydata.slidepicbox.children();
??????????????? var total = slidepic.length;
??????????????? slidepic.filter(":visible").fadeOut("fast", function () {
??????????????????? $(this).removeClass("current");
??????????????????? slidepic.eq(num).fadeIn("slow");
??????????????????? slidepic.eq(num).addClass("current");
??????????????? });
??????????????? if (mydata.slidetitlebox) {
??????????????????? var slidetitle = mydata.slidetitlebox.children();
??????????????????? slidetitle.filter(":visible").hide("fast", function () {
??????????????????????? $(this).removeClass("current");
??????????????????????? slidetitle.eq(num).show();
??????????????????????? slidetitle.eq(num).addClass("current");
??????????????????? });
??????????????? }
??????????????? if (mydata.slidebtnbox) {
??????????????????? var slidebtn = mydata.slidebtnbox.children();
??????????????????? slidebtn.eq(num).addClass("current");
??????????????????? slidebtn.eq(num).siblings().removeClass("current");
??????????????? }
??????????????? if (mydata.auto) {
??????????????????? var index = num >= total - 1 ? 0 : num + 1;
??????????????????? //alert(index);
??????????????????? mydata.autotime = setTimeout(function () { picplay(index, mydata); }, mydata.speed);
??????????????? }
??????????? }
??????? })(jQuery);
??????? </script>
</head>
<body>
??? <div>
??????? <div id="slidepic">
??????????? <a href="#" title="标题1"><img src="image/pic1.jpg" />1</a>
??????????? <a href="#" title="标题2"><img src="image/pic2.jpg" />2</a>
??????????? <a href="#" title="标题3"><img src="image/pic1.jpg" />3</a>
??????????? <a href="#" title="标题4"><img src="image/pic2.jpg" />4</a>
??????? </div>
??????? <div id="slidetitle">
??????????? <a href="#">标题1</a>
??????????? <a href="#">标题2</a>
??????????? <a href="#">标题3</a>
??????????? <a href="#">标题4</a>
??????? </div>
??????? <div id="slidebtn">
??????????? <a href="#">1</a>
??????????? <a href="#">2</a>
??????????? <a href="#">3</a>
??????????? <a href="#">4</a>
??????? </div>
??????? <script type="text/javascript">
??????????? var configdata = {
??????????? slidetitlebox:$("#slidetitle"),//标题对象(可无)
??????????? slidebtnbox: $("#slidebtn"), //按钮对象(可无)
??????????? auto:1,//1自动播放/0不自动播放
??????????? speed: 3000,//播放速度
??????????? frist: 0//从第几张开始
??????????? };
??????? $("#slidepic").slideshowpic(configdata);
??????? </script>
??? </div>
</body>
</html>
详细解决方案
jquery兑现图片幻灯片切换代码
热度:9 发布时间:2012-09-03 09:48:39.0
相关解决方案
- jquery 获取jsp页面的id解决方法
- jquery,二维数组取值。解决办法
- 求jquery.form.js+jquery.validate.min.js 用ajax提交表单的代码范例
- jquery 提交form表单不用插件的那种 如何提交
- jquery ajax回传没有值,该怎么处理
- jquery easyUI datagrid struts2有关问题
- jquery form 有关问题
- springmvc jquery ajax 提交复杂对象,415异常解决办法
- 应用Struts2 与 jquery,ajax验证用户注册,不用从数据库获取数据
- jquery ajax select解决方法
- php jquery check username ajax检察帐号唯一性
- jquery ajax返回值的有关问题
- jquery 或js 获取指定字符间的字符串,并轮换。回答出来的是大神级~
- jquery 的bind里面能不能获得返回值呢? 对小弟我很难的有关问题啊
- jquery 的uploadify下传图片怎么让出错信息提示成中文
- java+jquery easy ui + json + struts分页例子
- jquery easyui分页效率有关问题
- jquery 如何获得动态添加后的子元素个数?
- jQuery.ajax()请求struts2数据 回到data值了undefined
- 关于Struts2 jQuery Plugin的 Result,该如何处理
- Jquery 点击按钮实现图片翻页,该如何解决
- jquery 关于监听checkbox的选中和不选中事件,该如何解决
- jQuery append动态添加的页面对象如何处理刷新掉
- Jquery+json解决思路
- jquery post有关问题
- 求大神解决偏题 - jquery ajax
- jquery $.ajax有关问题
- jquery td遍历有关问题
- jquery ui taps有关问题,求解!
- jquery easyui 如何设置标题列居左,里面的数据列居右