摘要:织梦cms图片太大自动按比例缩放_网站sem优化培训_在文章内容页/head前插入以下代码:scriptlanguage=JavaScript!--//图片按比例缩放varflag=falsefunctionDrawImage(ImgD,
织梦cms图片太大自动按比例缩放_网站sem优化培训_在文章内容页/head前插入以下代码: script language=JavaScript !-- //图片按比例缩放 var flag=false function DrawImage(ImgD,iwidth,iheight) //参数(图片,允许的宽度,允许的高度) var image=new Image() image.src
在文章内容页</head>前插入以下代码:
<script language="JavaScript"> <!-- //图片按比例缩放 var flag=false; function DrawImage(ImgD,iwidth,iheight){ //参数(图片,允许的宽度,允许的高度) var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= iwidth/iheight){ if(image.width>iwidth){ ImgD.width=iwidth; ImgD.height=(image.height*iwidth)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } ImgD.alt=image.width+"×"+image.height; } else{ if(image.height>iheight){ ImgD.height=iheight; ImgD.width=(image.width*iheight)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } ImgD.alt=image.width+"×"+image.height; } } } //--> </script>
然后后台一键更新,这样就可以了。
本文内容主要是有关于::织梦cms图片太大自动按比例缩放和[网站sem优化培训]
如果您有想法通过seo排名。来获得精准流量。请添加客服咨询我们。专业的团队+AI智能让您没有后顾之忧。