From 1620a13565411cb7c3e82b055f1a2b96f16edcb3 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 27 Sep 2016 09:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87=E6=94=BE?= =?UTF-8?q?=E5=A4=A7js=E7=9A=84=E4=B8=80=E4=B8=AABUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index aeb9e645a..5165a67bc 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1054,10 +1054,12 @@ function showNormalImage(id) { //无格式的图片不让点击显示大图,显示的话会有问题 var tmpsrc = image.attr('src'); - if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) { - var element = $("").attr("href", image.attr('src')); - image.wrap(element); - $(image).parent().colorbox({rel: 'nofollow', close: "关闭", returnFocus: false}); + if(tmpsrc){ + if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) { + var element = $("").attr("href", image.attr('src')); + image.wrap(element); + $(image).parent().colorbox({rel: 'nofollow', close: "关闭", returnFocus: false}); + } } } //$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框