/** * vmc.slide 图片轮播jquery插件 v2.0.0 * 维米客网页工作室 vomoc.com * https://github.com/vomoc/vmc.slide * vomoc@qq.com * 2017/03/20 **/ ;(function ($, undefined) { $.vmcslideeffects({ // 横向滑动 'slidex': function (index) { var the = this, opts = the.options; if (index > the.index) { // next the.transfer[4].show().animate({ left: -the.width }, opts.speed, function () { $(this).css({ left: 0 }); the._resettransfer(index); }); } else { the.transfer[4].show().css('left', -the.width).animate({ left: 0 }, opts.speed, function () { the._resettransfer(index); }); } }, // 纵向滑动 'slidey': function (index) { var the = this, opts = the.options; if (index > the.index) { // next the.transfer[5].show().animate({ top: -the.height }, opts.speed, function () { $(this).css({ top: 0 }); the._resettransfer(index); }); } else { the.transfer[5].show().css('top', -the.height).animate({ top: 0 }, opts.speed, function () { the._resettransfer(index); }); } }, // 翻页 'page': function (index) { var the = this, opts = the.options; if (index > the.index) { the.transfer[0].show() .children('.vui-slide-grid') .css({ opacity: 0 }) .each(function (i) { var x = i % opts.gridtdx; var y = math.floor(i / opts.gridtdx); var delay = ((y + 1) / opts.gridtdy + (x + 1) / opts.gridtdx) / 2; delay = opts.speed / 3 * 2 * delay; $(this).delay(delay).animate({ opacity: 1 }, opts.speed / 3); }) .last() .queue(function () { the._resettransfer(index); }); } else { the.transfer[0] .show() .children('.vui-slide-grid') .css({ opacity: 0 }) .each(function (i) { var x = i % opts.gridtdx; var y = math.floor(i / opts.gridtdx); var delay = 1 - (y / opts.gridtdy + x / opts.gridtdx) / 2; delay = opts.speed / 3 * 2 * delay; $(this).delay(delay).animate({ opacity: 1 }, opts.speed / 3); }) .first() .queue(function () { the._resettransfer(index); }); } }, // 圆圈 'circle': function (index) { var the = this, opts = the.options; the.transfer[0].show() .children('.vui-slide-grid') .css({ opacity: 0, // margin:40, width: 0, height: 0, borderradius: '50%' }) .each(function (i) { var $this = $(this); var x = i % opts.gridtdx; var y = math.floor(i / opts.gridtdx); var delay = ((y + 1) / opts.gridtdy + (x + 1) / opts.gridtdx) / 2; delay = opts.speed / 3 * 2 * delay; $this.css({ marginleft: parseint($this.data('width')) / 2, margintop: parseint($this.data('height')) / 2, backgroundpositionx: -(parseint($this.data('imgleft')) + parseint($this.data('width')) / 2), backgroundpositiony: -(parseint($this.data('imgtop')) + parseint($this.data('height')) / 2) }); $this.animate({ opacity: 0.6, marginleft: 0, margintop: 0, backgroundpositionx: -parseint($this.data('imgleft')), backgroundpositiony: -parseint($this.data('imgtop')), width: $this.data('width'), height: $this.data('height'), // borderradius:0 }, opts.speed / 3 * 2, 'linear').animate({ opacity: 1, borderradius: 0 }, opts.speed / 3, 'linear'); }) .last() .queue(function () { the._resettransfer(index); }); }, // 横向卷帘 'rollingx': function (index) { var the = this, opts = the.options; if (index > the.index) { the.transfer[1].show().children('.vui-slide-grid').css({ opacity: 0 }).each(function (i) { var delay = opts.speed / 3 * 2 / opts.gridodx * (i + 1); $(this).delay(delay).animate({ opacity: 1 }, opts.speed / 3); }).last().queue(function () { the._resettransfer(index); }); } else { the.transfer[1].show().children('.vui-slide-grid').css({ opacity: 0 }).each(function (i) { var delay = opts.speed / 3 * 2 / opts.gridodx * (opts.gridodx - i); $(this).delay(delay).animate({ opacity: 1 }, opts.speed / 3); }).first().queue(function () { the._resettransfer(index); }); } }, // 纵向卷帘 'rollingy': function (index) { var the = this, opts = the.options; if (index > the.index) { the.transfer[2].show().children('.vui-slide-grid').css({ opacity: 0 }).each(function (i) { var delay = opts.speed / 3 * 2 / opts.gridody * (i + 1); $(this).delay(delay).animate({ opacity: 1 }, opts.speed / 3); }).last().queue(function () { the._resettransfer(index); }); } else { the.transfer[2].show().children('.vui-slide-grid').css({ opacity: 0 }).each(function (i) { var delay = opts.speed / 3 * 2 / opts.gridody * (opts.gridody - i); $(this).delay(delay).animate({ opacity: 1 }, opts.speed / 3); }).first().queue(function () { the._resettransfer(index); }); } }, // 横向百叶窗 'blindsx': function (index) { var the = this, opts = the.options; if (index > the.index) { the.transfer[1].show().children().css({ width: 0, opacity: 0 }).each(function (i) { var $this = $(this); var delay = opts.speed / 3 * 2 / opts.gridodx * (i + 1); $this.delay(delay).animate({ width: $this.data('width'), opacity: 1 }, opts.speed / 3); }).last().queue(function () { the._resettransfer(index); }); } else { the.transfer[1].show().children().css({ width: 0, opacity: 0 }).each(function (i) { var $this = $(this); var delay = opts.speed / 3 * 2 / opts.gridodx * (opts.gridodx - i); $this.delay(delay).animate({ width: $this.data('width'), opacity: 1 }, opts.speed / 3); }).first().queue(function () { the._resettransfer(index); }); } }, // 纵向百叶窗 'blindsy': function (index) { var the = this, opts = the.options; if (index > the.index) { the.transfer[2].show().children().css({ height: 0, opacity: 0 }).each(function (i) { var $this = $(this); var delay = opts.speed / 3 * 2 / opts.gridody * (i + 1); $this.delay(delay).animate({ height: $this.data('height'), opacity: 1 }, opts.speed / 3); }).last().queue(function () { the._resettransfer(index); }); } else { the.transfer[2].show().children().css({ height: 0, opacity: 0 }).each(function (i) { var $this = $(this); var delay = opts.speed / 3 * 2 / opts.gridody * (opts.gridody - i); $this.delay(delay).animate({ height: $this.data('height'), opacity: 1 }, opts.speed / 3); }).first().queue(function () { the._resettransfer(index); }); } } // 幕布 // 交叉 }); })(jquery);