Commit ee585b39 by lmf

修改轮播图跳转地址

parent 871e4dff
...@@ -28,17 +28,17 @@ ...@@ -28,17 +28,17 @@
require([ require([
'jquery' 'jquery'
], function ($) { ], function ($) {
$.fn.banner = function(options){ //fn是dom对象 $.fn.banner = function(options){
var that = this; var that = this;
options = options || {}; options = options || {};
this._obj = { this._obj = {
btn:options.btn===false ? false : true, //没传是undefined也是false btn:options.btn===false ? false : true,
list:options.list===false ? false : true, list:options.list===false ? false : true,
autoPlay:options.autoPlay===false ? false : true, autoPlay:options.autoPlay===false ? false : true,
delayTime:options.delayTime || 2000, delayTime:options.delayTime || 2000,
moveTime:options.moveTime || 200, moveTime:options.moveTime || 200,
index:options.index || 0, index:options.index || 0,
iPrev:options.img.length-1,//可有可不有 iPrev:options.img.length-1,
img:options.img || [], img:options.img || [],
href:options.href || [], href:options.href || [],
}; };
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
}); });
} }
this._obj.init(); this._obj.init();
this._obj.leftClick=function () {//this是left this._obj.leftClick=function () {
if (that._obj.index ==0){ if (that._obj.index ==0){
that._obj.index = that._obj.img.length-1; that._obj.index = that._obj.img.length-1;
that._obj.iPrev=0; that._obj.iPrev=0;
...@@ -79,8 +79,7 @@ ...@@ -79,8 +79,7 @@
} }
that._obj.btnMove(1); that._obj.btnMove(1);
} }
//点击右边的按钮 this._obj.rightClick=function(){
this._obj.rightClick=function(){//this是right
if (that._obj.index ==that._obj.img.length-1){ if (that._obj.index ==that._obj.img.length-1){
that._obj.index = 0; that._obj.index = 0;
that._obj.iPrev=that._obj.img.length-1; that._obj.iPrev=that._obj.img.length-1;
...@@ -197,7 +196,7 @@ ...@@ -197,7 +196,7 @@
} }
$(".banner1").banner({ $(".banner1").banner({
img: img_arr, img: img_arr,
href: ["/hotsale.html", "/newarrivals.html"], href: ["/shapewear", "/shapewear"],
btn: true, btn: true,
list: true, list: true,
autoPlay: true, autoPlay: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment