jquery轮播焦点图,jquery轮播,jquery焦点图
web前端-js教程
直接上代码,可能不是最好的,欢迎吐槽。棋牌源码有麻将牛牛,ubuntu 支持触摸吗,tomcat只重启服务器,网页音乐爬虫ppt,郑州php培训多少钱,东莞seo托管lzw
/** * Created by Steven on 2015/07/10/0010. * @email zhuttymore@126.com */ (function ($) { $.fn.slider = function (opt) { opt = $.extend({ speed:'fast', auto: false, interval: 1000 }, opt); var _this = this; var index = 0; _this.find('.window li').width(_this.width()); var animate = function(index){ var win = _this.find('.window'); var offset = win.parent().width(); win.animate({'marginLeft': -offset * index}, opt.speed); _this.find('.tab li').removeClass('select'); _this.find('.tab li').eq(index).addClass('select'); }; _this.find('.tab li').mouseover(function () { index = parseInt($(this).index()); animate(index); }); _this.find('.btn li:first-child').click(function(){ --index; if(index = _this.find('.window li').length){ index = 0; } animate(index); }); if(opt.auto){ var time = setInterval(function(){ ++index; if(index >= _this.find('.window li').length){ index = 0; } animate(index); },opt.interval); } return $.each(this,function(index,ele){}); }; })(jQuery);Html
android 源码网打不开,ubuntu挂载旧硬盘,把tomcat添加本地服务,lol战绩爬虫,php冒泡函数,建立谷歌独立站seo多少钱lzw
CSS
8ppg源码,vscode高亮插件下载,ubuntu 新增源,tomcat7 jta,爬虫桌面,php 月最后一天,闽清专业seo服务电话,图片网站采集源码,客户网站模板下载吗lzw
.slider { height: 440px; overflow: hidden; position: relative; } .slider .btn li{ position: absolute; width: 30px; height: 50px; cursor: pointer; color: #fff; text-align: center; font-size: 40px; top:45%; } .slider .btn li:first-child { left:0; } .slider .btn li:last-child { right:0; } .slider img { width: 100%; height: 100%; } .slider .window { width: 40000px; height: 400px; overflow: hidden; } .slider .window li { float: left; overflow: hidden; width: 1200px; } .slider .tab { position: absolute; z-index: 5; width: 880px; margin: -40px auto; left: 13%; } .slider .tab li { float: left; width: 200px; height: 80px; margin-left: 18px; cursor: pointer; }Css文件可以根据需求自己DIY, 但html的.slider里面的结构应该是一样。
Run 起来:
$(‘.slider’).slider({auto: true, interval: 2000});
改进js结构:
/** * Created by Steven on 2015/07/10/0010. * @email zhuttymore@126.com */(function ($) { $.fn.extend({ slider:function (opt) { opt = $.extend({ }, opt); //Do something here return $.each(this,function(index,ele){}); } });})(jQuery);