function imagemoduleresultfn(moduleid, layout, option) { var module = $('#module_' + moduleid); if (layout == '108') { var moduleidselector = "#module_" + moduleid; loadstylesheet('/scripts/wookmark/css/lightgallery.min.css'); addscript('/scripts/wookmark/lightgallery.js', function () { addscript('/scripts/wookmark/lg-fullscreen.min.js'); addscript('/scripts/wookmark/lg-thumbnail.min.js'); addscript('/scripts/wookmark/lg-zoom.min.js'); if ($(moduleidselector + ' .gallery-list').css('display') !== 'none') { // 瀑布流插件 if ($(moduleidselector + ' .gallery-list').attr('iscarousel') != 1 && layout == '108') { $(moduleidselector + ' .gallery-list').imagesloaded(function () { $(moduleidselector + ' .gallery-list').masonry({ itemselector: '.grid-item', fitwidth: true }); }); } } }) } if (layout == '102') { //图片的半透明效果 module.find('.image-animation').off('mouseover').on('mouseover', function () { $(this).animate({ opacity: 0.7 }, 300, function () { // 4 }); }) //图片不透明 module.find('.image-animation').off('onmouseout').on('onmouseout', function () { $(this).animate({ opacity: 1 }, 300, function () { }); }) } if (layout == '104' || layout == '105' || layout == '106') { //浮影 var osettimeout = null; function imgshade(obj, type) { var windowwidth = $(window).width(); var odiv = $(obj).parent().find("div[name='shade']"); $(obj).parent().css("position", "relative"); if ($(obj).parent().is("a")) $(obj).parent().css("display", "block"); if (odiv.length == 0) { odiv = $("
" + $(obj).attr('alt') + "
").appendto($(obj).parent()).css('height', 0); } var bc = $(obj); var left = bc.offset().left - $(obj).closest('.bodycenter').offset().left; var w = bc.outerwidth(); var h = bc.outerheight(); var bodycenter = $(obj).closest('.bodycenter'); if (type == 'shadetop') { var top = bodycenter.css('padding-top'); $(odiv).attr("class", "showshadetop").css({'width': w, 'left': left, 'top': top}).show(); } else if (type == 'shadebottom') { $(odiv).css({ 'width': w, 'left': left, 'bottom': bodycenter.css('paddingbottom'), 'position': 'absolute', 'color': '#fff', 'background': 'rgba(0,0,0,.7)', 'line-height': '40px' }).show(); } else { $(odiv).attr("class", "showshadetop").css({'width': w, 'left': left, 'top': 0}).show(); } var isshadeall = type == 'shade'; var tp = bodycenter.css('padding-top'); if (isshadeall) $(odiv).css({'line-height': h + 'px', 'font-size': '16px', 'top': tp}); $(odiv).stop().animate({height: (isshadeall ? h + 'px' : "40px")}, (isshadeall ? 500 : 200), function () { }) if (windowwidth >= 768) { $(odiv).off('mouseenter').on('mouseenter', function () { cleartimeout(osettimeout); }); $(odiv).off('mouseleave').on('mouseleave', function () { divzoom(odiv, type); }); } } function unimgshade(obj, type) { if ($(window).width() < 768) { return } if ($(obj).parent().find("div[name='shade']").length == 0) $(obj).parent().append("
" + $(obj).attr('alt') + "
"); var odiv = $(obj).parent().find("div[name='shade']"); osettimeout = settimeout(function () { divzoom(odiv, type); }, 200); } function divzoom(obj, type) { $(obj).stop().animate({ height: "0px" }, layout == '106' ? 500 : 200, function () { if (type == 'shadetop') $(obj).attr("class", "hideshadetop").hide(); else $(obj).attr("class", "hideshadebottom").hide(); }); } var windowwidth = $(window).width(); switch (layout) { case '104': direction = 'shadebottom'; break; case '105': direction = 'shadetop'; break; case '106': direction = 'shade'; } module.find('.image-animation').off('mouseover').on('mouseover', function () { switch (layout) { case '104': direction = 'shadebottom'; break; case '105': direction = 'shadetop'; break; case '106': direction = 'shade'; } if (layout == '106') { if (windowwidth >= 768) { imgshade(this, direction) } return; } imgshade(this, direction) }) module.find('.image-animation').off('mouseout').on('mouseout', function () { unimgshade(this, direction); }) /*#module_moduleid*/ var prevwimg = module.find('.image-animation'); if (windowwidth < 768) { prevwimg.mouseover(); prevwimg[0].onload = function () { if (layout != '106') { imgshade(this, direction) } } } $(window).off('resize.' + moduleid).on('resize.' + moduleid, function () { var bt = (prevwimg.closest('.bodycenter').outerheight() - prevwimg.outerheight()) / 2; var windowwidth = $(window).width(); module.find("div[name='shade']").css({ 'left': prevwimg.offset().left - prevwimg.closest('.bodycenter').offset().left, 'bottom': bt, 'width': prevwimg.outerwidth() }); if (windowwidth < 768) { layout == '106' ? prevwimg.parent().find('div').removeclass('showshadetop') : prevwimg.mouseover(); } else { prevwimg.mouseout() } module.find('.image-animation').off('mouseover').on('mouseover', function () { switch (layout) { case '104': direction = 'shadebottom'; break; case '105': direction = 'shadetop'; break; case '106': direction = 'shade'; } if (layout == '106') { if (windowwidth >= 768) { imgshade(this, direction) } return; } imgshade(this, direction) }) module.find('.image-animation').off('mouseout').on('mouseout', function () { unimgshade(this, direction); }) }) } if (layout == '107') { function imgzoom(obj) { var scale = $(obj).width() > 500 ? 1.02 : 1.10; var step = $(obj).width() > 500 ? 0.001 : 0.005; $(obj).attr('zoom-step', step); $(obj).parent().attr('zoom-overflow', $(obj).parent().css('overflow')); $(obj).parent().css({'overflow': 'hidden'}); if ($(obj).parent().is('a')) $(obj).parent().css({'display': 'block'}); $(obj).css({ '-webkit-transform': 'scale(' + scale + ')', '-ms-transform': 'scale(' + scale + ')', '-moz-transform': 'scale(' + scale + ')', '-o-transform': 'scale(' + scale + ')', 'transform': 'scale(' + scale + ')' }); } function unimgzoom(obj) { var scale = 1; $(obj).css({ '-webkit-transform': 'scale(' + scale + ')', '-ms-transform': 'scale(' + scale + ')', '-moz-transform': 'scale(' + scale + ')', '-o-transform': 'scale(' + scale + ')', 'transform': 'scale(' + scale + ')' }); } module.find('.image-animation').off('mouseover').on('mouseover', function () { imgzoom(this, 'zoom') }) module.find('.image-animation').off('mouseout').on('mouseout', function () { unimgzoom(this, 'zoom') }) } }