[英]My blogger Javascript keeps making my pictures disappear
我最近添加了一个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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.