我有這個傳送帶,我需要根據媒體大小更改圖像,我使用這個HTML和CSS,它的工作原理,但第二個和第三個圖像首先顯示爲空白(旋轉木馬消失),然後像6秒鐘後,圖像出現。如果我不使用CSS,他們正常加載。用媒體查詢改變傳送帶圖像奇怪的錯誤
我已經嘗試添加顯示塊到我要顯示的那些,但不工作,要麼
@media only screen and (max-width: 479px) {
#slider1-lg { display: none; }
#slider2-lg { display: none; }
#slider3-lg { display: none; }
}
@media only screen and (min-width: 768px) {
#slider1-sm { display: none; }
#slider2-sm { display: none; }
#slider3-sm { display: none; }
}
<div id="myCarousel2" class="carousel slide carouseltop" data-ride="carousel">
<div class="carousel-inner " role="listbox">
<div id="slider1-lg" class="item active"> <img src="img/slider/slide-01-hm-1920.jpg" width="100%" height="100%"> </div>
<div id="slider1-sm" class="item "> <img src="img/slider/slide-01-hm-720.jpg" width="100%" height="100%"> </div>
<div id="slider2-lg" class="item "> <img src="img/slider/slide-02-hm-1920.jpg" width="100%" height="100%"> </div>
<div id="slider2-sm" class="item "> <img src="img/slider/slide-02-hm-720.jpg" width="100%" height="100%"> </div>
<div id="slider3-lg" class="item "> <img src="img/slider/slide-03-hm-1920.jpg" width="100%" height="100%"> </div>
<div id="slider3-sm"class="item "> <img src="img/slider/slide-03-hm-720.jpg" width="100%" height="100%"> </div>
</div>
<a class="left carousel-control" href="#myCarousel2" role="button" data-slide="prev"> <span style="color:#fff" class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a>
<a class="right carousel-control" href="#myCarousel2" role="button" data-slide="next"> <span style="color:#fff" class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a>
</div>