' } html += '
' html += str html += '
' html += '
' html += '' html += '' } $('#page').prepend(html); $(".sj-section-category-menu").each(function(){ if($.trim($(this).text()) == ""){ $(this).removeClass("sj-section-category-menu"); $(this).parent().parent().removeClass("postContents"); $(this).addClass("sj-section-banner"); } }); $('.sj-section-banner img').each(function(num, value){ var src = $(value).attr('src'); $(value).css('display','none'); var box = '
' $(value).after(box); }) } } showPostContent(); function showNLContent(content,direction,title){ var currentIndex = [] var boxHTML = content; var reg = /#\?\?#/g; do{ var ret = {} var arr = reg.exec(boxHTML); if(arr){ ret.type = 0; ret.index = arr['index']; currentIndex.push(ret) } }while(arr) function getLastIndex(index, currentIndex){ var clen = currentIndex.length-1 var cindex = 0; if(index == 0){ return 0 }else{ cindex = index - 1; } return currentIndex[cindex].index } var html = "" if(currentIndex.length == 0){ html += '
' html += '
' html += '' html += '
' html += '
' $(direction).after(html); }else{ for(key in currentIndex){ var lastIndex = getLastIndex(key, currentIndex); var str = boxHTML.substring(lastIndex, currentIndex[key].index); var reg = new RegExp("' html += '
' html += '
' if(key == 0){ html += '

'+title+'

' } html += '
' html += str html += '
' html += '
' html += '
' html += '' } $(direction).after(html); $(".sj-section-category-menu").each(function(){ if($.trim($(this).text()) == ""){ $(this).removeClass("sj-section-category-menu"); $(this).parent().parent().removeClass("postContents"); $(this).addClass("sj-section-banner"); } }); $('.sj-section-banner img').each(function(num, value){ var src = $(value).attr('src'); $(value).css('display','none'); var box = '
' $(value).after(box); }) } } if($(".nextC").size() > 0){ showNLContent($(".nextContents").html(),'.nextC','春季调研说化纤: 强者自强力度不减'); } if($(".lastC").size() > 0){ showNLContent($(".lastContents").html(),'.lastC','开衫怎么搭配复古菱格针织半身裙'); } if($(window).height() <= 670){ $(".postContents img").each(function(){ $(this).height($(this).height()*0.8); $(this).width('auto'); }); } /* 查看原图 */ var sale = 1150 / 750; var ph = 165/1080; var pw = 385/1920; var box_h = Math.ceil($(window).height() - ($(window).height() * ph * 2)); var box_w = Math.ceil($(window).width() - ($(window).width() * pw * 2)); $(".imgShow").css({maxWidth:box_w,maxHeight:box_h}); $(".imgBox").css({width:box_w,height:box_h}); $(".imgOpen").click(function(e){ e.stopPropagation(); e.preventDefault(); var src = $(this).parent().prev().attr("src"); var newSrc = src.split('.')[0] + '@2x.' + src.split('.')[1]; if(validateImage(newSrc)){ $(".imgMask").fadeIn(); $(".imgShow").attr("src",newSrc); }else{ $(".imgMask").fadeIn(); $(".imgShow").attr("src",src); } $(".imgShow").load(function(){ $(".imgContent").css({width:$(".imgShow").width(),height:$(".imgShow").height()}); }); $(".imgClose").click(function(){ $(".imgMask").fadeOut(); }); }); $(".contentImg").hover(function(){ if($(this).attr("data-echo") != ''){ $(this).find(".imgOpen").show(); } },function(){ $(this).find(".imgOpen").hide(); }); $(".postContents img").each(function(){ $(this).parent().css({position:'relative',display:'inline-block'}); var left = $(this).position().left + $(this).width() - 30; var sImg = ''; $(this).parent().append(sImg); $(this).parent().hover(function(){ $(this).find(".imgOpenC").show(); },function(){ $(this).find(".imgOpenC").hide(); }); }); $(".imgOpenC").click(function(e){ e.stopPropagation(); e.preventDefault(); var src = $(this).siblings("img").attr("src"); var arr1 = src.substring(0,src.lastIndexOf('.')); var arr2 = src.substring(src.lastIndexOf('.')); var newSrc = arr1 + '@2x' + arr2; if(validateImage(newSrc)){ $(".imgMask").fadeIn(); $(".imgShow").attr("src",newSrc); }else{ $(".imgMask").fadeIn(); $(".imgShow").attr("src",src); } $(".imgShow").load(function(){ $(".imgContent").css({width:$(".imgShow").width(),height:$(".imgShow").height()}); }); $(".imgClose").click(function(){ $(".imgMask").fadeOut(); }); }); function validateImage(url) { var xmlHttp ; if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } xmlHttp.open("Get",url,false); xmlHttp.send(); if(xmlHttp.status==404) return false; else return true; }