maxnum){ maxnum = cnum; } }); $('.pics-list a').bind('click', function (e) { var num = parseInt($(this).attr('data-num')); var imgList = '.pics-list a'; openshowImg(num,maxnum,imgList); }); function openshowImg(num,maxnum,imgList) { jQuery("body").append('
'); for(var i = 0 ; i <= maxnum ; i++){ jQuery('.imgShowDemo').append('

'+$(imgList+'[data-num='+i+']').attr('title')+'

') var imgurl = $(imgList+'[data-num='+i+']').attr('data-img'); jQuery('.imgShowDemo .item').eq(i).find(".img").attr("src",imgurl); } var w_height=$(window).height(); jQuery(".imgShowBox").css({ height: w_height }); jQuery('.imgShowDemo').css({ height: w_height }); jQuery('.imgShowDemo .item').css({ height: w_height }); jQuery(window).resize(function(){ jQuery(".imgShowBox").css({ height: w_height }); jQuery('.imgShowDemo').css({ height: w_height }); jQuery('.imgShowDemo .item').css({ height: w_height }); }); var imgowl=jQuery(".imgShowDemo").slick({ autoplay: false, arrows: true, dots: false, infinite: true, speed: 500, pauseOnHover: false }); jQuery(".imgShowDemo").slick('slickGoTo',num); setTimeout(function () { $('.imgShowBox').addClass('img-show'); }, 300); }; $(document).on('click','.overlayClose',function(){ $('.imgShowBox').removeClass('img-show'); setTimeout(function () { jQuery('.imgShowBox').remove(); }, 800); }); function setImgMax(img, imgW, imgH, tW, tH) { var tWidth = tW || w_width; var tHeight = tH || w_height; var coe = imgH / imgW; var coe2 = tHeight / tWidth; if (coe < coe2) { var imgWidth = tHeight / coe; img.css({ height: tHeight, width: imgWidth, left: -(imgWidth - tWidth) / 2, top: 0 }); } else { var imgHeight = tWidth * coe; img.css({ height: imgHeight, width: tWidth, left: 0, top: -(imgHeight - tHeight) / 2 }); }; };
XML 地图