默认的phpcms手机版 二开的时候没显示小图导致有的图片拉的很长
怎么解决这个问题呢,phpcms本来手机端有个点击显示大图的功能,这里介绍宁外一个方法,通过js去实现
<script type="text/javascript"> window.onload=function (){ var aImg=document.getElementById("Article").getElementsByTagName('img'); for(var i=0;i<aImg.length;i++){ var image = new Image(); image.src = aImg[i].src; width1=image.height*screen.width/image.width; aImg[i].style.width=0.78*screen.width+"px"; aImg[i].style.height=(width1*0.78)+"px"; } } </script>
在需要的页面 如 文章详情页面,使用方式在内容显示加个id="Article"
然后调试
问题解决