/* * * images fullplay * author: join fisher * version: 1.0 (1-jun-2016) * */ (function($) { $.fn.fullimages = function(fisher) { var fisher = $.extend({ imgwidth: null, imgheight: null, autoplay: null, fadetime: null }, fisher) var count = $(this).find("img").length; var nvalue = 0; var ovalue = 0; var _this = $(this); _this.find("img:eq(0)").fadein("slow"); var setintervalimg = setinterval(function() { nvalue++ if (nvalue == count) { nvalue = 0; } _this.find(" img:eq(" + (nvalue) + ")").fadein(fisher.fadetime); _this.find(" img:eq(" + (ovalue) + ")").fadeout(fisher.fadetime); ovalue = nvalue % count; }, fisher.autoplay); resizefun(); $(window).resize(function(e) { resizefun(); }); function resizefun() { /*轮播图全屏*/ var imgh = fisher.imgheight; var imgw = fisher.imgwidth; var hvalue = imgh / imgw; var wvalue = imgw / imgh; if ($(window).width() / $(window).height() < wvalue) { _this.find("img").css("width", $(window).height() * wvalue); _this.find("img").css("margin-left", -(($(window).height() * wvalue) - $(window).width()) / 2); _this.find("img").css("height", $(window).height()); } else { _this.find("img").css("width", $(window).width()); _this.find("img").css("margin-left", 0); _this.find("img").css("height", $(window).width() * hvalue); } } }; } (jquery));