Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的博客Javascript一直在让我的照片消失_Javascript_Image_Blogger - Fatal编程技术网

我的博客Javascript一直在让我的照片消失

我的博客Javascript一直在让我的照片消失,javascript,image,blogger,Javascript,Image,Blogger,我最近添加了一个javascript代码,它适用于文章宽度内的所有图像。太好了!但它会导致我的图像在几秒钟后消失,留下破碎的图像图标。我怎样才能解决这个问题? 以下是我添加到页面的代码: <script language='javascript'src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js' type='text/javascript'/> <script type='text/ja

我最近添加了一个javascript代码,它适用于文章宽度内的所有图像。太好了!但它会导致我的图像在几秒钟后消失,留下破碎的图像图标。我怎样才能解决这个问题? 以下是我添加到页面的代码:

<script language='javascript'src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js' type='text/javascript'/>
 <script type='text/javascript'>//<![CDATA[
/**
this script was written by Confluent Forms LLC http://www.confluentforms.com
for the BlogXpertise website http://www.blogxpertise.com
any updates to this script will be posted to BlogXpertise
please leave this message and give credit where credit is due!
**/
$(document).ready(function(){
    // the dimension of your content within the columns
    var areawidth = $('#Blog1').width();
    $('.post-body').find('img').each(function(n, image){
        var image = $(image);
        var height = image.attr('height');
        var width = image.attr('width');
        var newHeight = (height/width * areawidth).toFixed(0);
        image.attr('width',areawidth).attr('height',newHeight);
        var greater = Math.max(areawidth,newHeight);
        image.attr({src : image.attr('src').replace(/s\B\d{3,4}/,'s' + greater)});
    });
});
//]]></script>

这是我网站的链接:benjaminkristenreeves.blogspot.com

我在IE和Chrome中尝试了你的博客网站,但图像似乎保留了下来。顺便说一句,CSS表达式只依赖于IE——在chrome中不起作用。一段jQuery代码做一些基本的工作,需要积分,积分几乎比代码TT长。扔掉它,用css做。绝对不需要javascript来完成这项任务,它就像两行css。为什么在代码中有一个正则表达式来调整图像的大小?这很可能是由正则表达式的最后一行引起的,它改变了图像源的路径,在没有明显原因的情况下,用3或4位数字替换s加上图像的新大小。如果你去掉它,它会工作的。此解决方案显然需要上传不同大小的图像,以适应每种可能的图像大小。