【发布时间】:2017-02-07 14:05:44
【问题描述】:
我已经尝试过更改 css,我可以通过在它周围创建一个 div 来更改它的宽度,例如,给它一个 80% 的宽度。但我不能那样改变高度。有人知道如何改变高度吗?请参阅下面的链接。
附言。无法在 sn-p 或没有空格键的情况下复制链接。抱歉。
代码笔:http://codepen.io/SitePoint/pen/ZbGwqe/
Js:
var $item = $('.carousel .item');
var $wHeight = $(window).height();
$item.eq(0).addClass('active');
$item.height($wHeight);
$item.addClass('full-screen');
$('.carousel img').each(function() {
var $src = $(this).attr('src');
var $color = $(this).attr('data-color');
$(this).parent().css({
'background-image' : 'url(' + $src + ')',
'background-color' : $color
});
$(this).remove();
});
$(window).on('resize', function (){
$wHeight = 200;
$item.height($wHeight);
});
$('.carousel').carousel({
interval: 6000,
pause: "false"
});
【问题讨论】:
-
你不能因为你使用背景图片而不是图片标签。
标签: javascript jquery twitter-bootstrap twitter-bootstrap-3 slider