[英]How to set the size of dynamically created bootstrap Carousel images to desktop size regardless of uploaded image size
我試過這樣的東西,但它不適合窗戶的屏幕。 有一個向上和向下滾動的空間但如果它適合屏幕則不應該在那里。
$(document).ready(function () {
var $item = $('.carousel .item');
var $Wwidth = $(window).width();
$item.eq(0).addClass('active');
$item.width($Wwidth);
$item.addClass('full-screen');
$(window).on('resize', function () {
$item.width($Wwidth);
});
}
最后,我通過聲明一個高度變量修復了這個問題,如下所示。 如果任何人面臨同樣的問題,這將有助於他們。
$(document).ready(function () {
var $item = $('.carousel .item');
var $Wwidth = $(window).width();
var $wHeight = $(window).height();
$item.eq(0).addClass('active');
$item.height($wHeight);
$item.width($Wwidth);
$item.addClass('full-screen');
$(window).on('resize', function () {
$item.height($wHeight);
$item.width($Wwidth);
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.