[英]I resized with GIMP and mtPaint, it does not work. The image size does not change when I put it slideshow
var myIndex = 0; carousel(); function carousel() { var i; var x = document.getElementsByClassName("mySlides"); for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } myIndex++; if (myIndex > x.length) {myIndex = 1} x[myIndex-1].style.display = "block"; setTimeout(carousel, 2000); // Change image every 2 seconds }
.mySlides {display:none;}
<body> <h2 class="w3-center">Automatic Slideshow</h2> <div class="w3-content w3-section" style="max-width:600px"> <img class="mySlides" src="cigand1.jpeg" style="width:30%"> <img class="mySlides" src="eu1.jpeg" style="width:30%"> <img class="mySlides" src="hun1.jpg" style="width:30%"> </div> </body>
I am not sure but checking your code, you are just setting a max-width to the image. 我不确定,但是请检查您的代码,您只是在设置图像的最大宽度。
<div class="w3-content w3-section" style="max-width:600px">
That means, if the picture width is less than 600px, (500px for instance) it will display a 500px width picture. 这意味着,如果图片宽度小于600像素(例如500像素),它将显示500像素宽度的图片。
You can try something like this 您可以尝试这样的事情
<div class="w3-content w3-section" style="width:600px">
But the best way to do so, is to have all the pictures with the same width. 但是最好的方法是使所有图片具有相同的宽度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.