1(function($) { 2 $.fn.poposlides = function(options) { 3 4 var settings = $.extend({ 5 auto:true, //èªå¨ææ¾ 6 nav:true, //忢æé® 7 playspeed:8000, //èªå¨ææ¾é度 8 fadespeed:500, //æ·¡å ¥æ·¡åºé度 9 loop:true, //å¾ªç¯ææ¾ 10 pagination:true, //é¡µç æ¾ç¤º 11 pagecenter:true, //页ç å± ä¸ 12 prev:".prev", //ä¸ä¸é¡µæé® 13 next:".next" //ä¸ä¸é¡µæé® 14 }, options); 15 16 return this.each(function() { 17 18 var $this = $(this), 19 slide = $this.children(), 20 index = 0; 21 len = slide.length-1, 22 slideWidth = $this.width(), 23 prev = settings.prev, 24 next = settings.next; 25 26 //åå§éèå ¶å®é¡µï¼æ¾ç¤ºå½å页 27 if(!navigator.userAgent.match(/mobile/i)){ 28 slide.hide(); 29 slide.eq(index).show(); 30 }else{ 31 slide.css({ 32 "opacity":"0" 33 }); 34 slide.eq(index).css({ 35 "opacity":"1" 36 }); 37 }; 38 39 if(len == 0) { 40 settings.auto = false; 41 settings.loop = false 42 } else { 43 settings.auto = true; 44 settings.loop = true 45 } 46 47 48 //æ¾ç¤ºå½å页 49 slideFadeIn = function(){ 50 if(!navigator.userAgent.match(/mobile/i)){ 51 slide.fadeOut(settings.fadespeed); 52 slide.eq(index).fadeIn(settings.fadespeed); 53 }else{ 54 slide.css({ 55 "opacity":"0", 56 "-webkit-transition": settings.fadespeed/1000+"s" 57 }); 58 slide.eq(index).css({ 59 "opacity":"1", 60 "-webkit-transition": settings.fadespeed/1000+"s" 61 }); 62 }; 63 }; 64 65 //翻页å ï¼å¤ææ¯å¦å¾ªç¯ 66 slideAdd = function() { 67 console.log(settings.loop,'settings.loop') 68 if(settings.loop){ 69 index == len?index=0:index++; 70 }else{ 71 index == len?index=len:index++; 72 }; 73 slideFadeIn(); 74 }; 75 76 //翻页åï¼å¤ææ¯å¦å¾ªç¯ 77 slideMinus = function() { 78 if(settings.loop){ 79 index == 0?index=len:index--; 80 }else{ 81 index == 0?index=0:index--; 82 }; 83 slideFadeIn(); 84 }; 85 86 //页ç 87 pagnation = function(){ 88 var $paginationBox = $("<ul class='pagination006'></ul>"); 89 var paginationStr =""; 90 for(var i=1;i<=len+1;i++){ 91// paginationStr +="<li><a href='javascript:void(0)'>"+ i +"</a>"; 92 } 93 $paginationBox.append(paginationStr); 94 $this.after($paginationBox); 95 96 $(".pagination006 li a").eq(index).addClass("active"); 97 98 }; 99 100 //å½å页ç 101 pageActive = function(){ 102 $(".pagination006 li a").removeAttr("class") 103 $(".pagination006 li a").eq(index).addClass("active"); 104 } 105 106 //æ¯å¦éè¦å·¦å³å¯¼èªå¾æ 107 if(settings.nav) { 108 var navStr = "<a href='javascript:void(0)' class="+ prev.substring(1) +"></a>" + 109 "<a href='javascript:void(0)' class="+ next.substring(1) +"></a>"; 110 $this.after(navStr); 111 112 $(next).click(function(){ 113 slideAdd(); 114 }); 115 116 $(prev).click(function(){ 117 slideMinus(); 118 }) 119 }; 120 121 //æ¯å¦éè¦é¡µç 122 if(settings.pagination) { 123 pagnation(); 124 $(prev).click(function(){ pageActive();}); 125 $(next).click(function(){ pageActive();}); 126 127 $(".pagination006 li").click(function(){ 128 var idx = $(this).index()-1; 129 index = idx; 130 slideAdd(); 131 pageActive(); 132 }); 133 }; 134 135 //页ç å± ä¸ 136 if(settings.pagecenter){ 137 var pw = $(".pagination006").width(); 138 $(".pagination006").css({ 139 "position":"absolute", 140 "left":"50%", 141 "bottom":"5px", 142 "margin-left":-pw/2, 143 "z-index": "99" 144 }) 145 }; 146 147 //æ¯å¦èªå¨ææ¾ 148 if(settings.auto){ 149 var play = setInterval(function(){ 150 slideAdd(); 151 pageActive(); 152 },settings.playspeed); 153 $this.nextAll().hover(function () { 154 clearInterval(play);
155 }, 156 function(){ 157 play = setInterval(function(){ 158 slideAdd(); 159 pageActive(); 160 },settings.playspeed); 161 }); 162 }; 163 164 165 }); 166 }; 167 168})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.