【问题标题】:How to set the size of dynamically created bootstrap Carousel images to desktop size regardless of uploaded image size无论上传的图像大小如何,如何将动态创建的引导轮播图像的大小设置为桌面大小
【发布时间】:2017-07-14 23:46:53
【问题描述】:

我尝试过类似的方法,但它不适合窗口的屏幕。 有一个空间可以上下滚动,但如果它适合屏幕,则不应存在。

$(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);
        });                    
 }

【问题讨论】:

    标签: jquery html css twitter-bootstrap


    【解决方案1】:

    最后我通过声明一个高度变量来解决这个问题,如下所示。如果有人遇到同样的问题,这将对他们有所帮助。

            $(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);
            });
    
        });
    

    【讨论】:

      猜你喜欢
      • 2019-06-21
      • 2019-06-27
      • 1970-01-01
      • 2019-02-11
      • 2013-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多