jquery - 包装/masonry 网格全宽

标签 jquery html css image masonry

试图让我的图片库跨越整个页面。

这是一个 photo that show's white space at the right of the gallery

是否可以让厨房完全覆盖屏幕上的所有空白区域,不包括页脚。

这是 HTML:

           <div id="content" class="grid">

    <div class="grid-item">
      <img src="Gallery/TA-KU-19.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/BBNG-8.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/BBNG-13.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/BBNG-16.jpg" alt="" />
    </div>

    <div class="grid-item featured">
      <img src="Gallery/deathgrips-9.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/BBNG-20.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/death grips-18.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/BBNG-17.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/deathgrips-17.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/deathgrips-20.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/TA-KU-11.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/TA-KU-23.jpg" alt="" />
    </div>

    <div class="grid-item">
      <img src="Gallery/BBNG-11.jpg" alt="" />
    </div>
  </div>

这是 CSS:

            #content {
        /*width: 980px;*/
        /*width: 95%;*/
        width: 100%;
        margin-bottom: 0px;
        padding-bottom: 0px;
        z-index: -99999;
        position: relative;
        /*right: -15px;*/
        overflow: hidden;
      }
      .grid-item {
        display: inline-block;
        width: 450px;
        -webkit-transition: left .4s ease-in-out, top .4s ease-in-out .4s;
        -moz-transition: left .4s ease-in-out, top .4s ease-in-out .4s;
        -ms-transition: left .4s ease-in-out, top .4s ease-in-out .4s;
        -o-transition: left .4s ease-in-out, top .4s ease-in-out .4s;
        transition: left .4s ease-in-out, top .4s ease-in-out .4s;
        margin-bottom: 0;
      }
      .featured {
        width: px;
      }
      .grid-item img {
        display: block;
        width: 100%;
      }
      .featured img {
        width: 100%;
      }

最后是 Jquery:

            $('.grid').packery({
        // options
        itemSelector: '.grid-item',
        gutter: 0,

      });

      $('.grid').packery({
        percentPosition: true
      })

最佳答案

在你的 CSS 上替换它

        #content {
    /*width: 980px;*/
    /*width: 95%;*/
    width: 100%;
    margin-bottom: 0px;
    padding-bottom: 0px;
    z-index: -99999;
    position: relative;
    /*right: -15px;*/
    overflow: hidden;
  }

由此

#content {
    text-align: center;
    width: 100%;
    margin-bottom: 0px;
    padding-bottom: 0px;
    z-index: -99999;
    position: relative;
    /*right: -15px;*/
    overflow: hidden;
}

关于jquery - 包装/masonry 网格全宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42531957/

相关文章:

javascript - 在 Javascript (jQuery) 完成之前更新 CSS

javascript - 读取 JSON 对象中的数组

javascript - 在 JS 中自行执行并调用函数

javascript - 有没有可能通过 jquery 或 javascript 运行选择 sql 查询的方法

php - 使文本框不可见或只读

javascript - jquery-如何为具有多个类的元素定义特定变量类

css - 为什么 flexboxgrid 有媒体查询?

html - flex 1 :1 is not working with Ionic grid. 我需要分配空间 50:50

html - 为什么会有这个额外的空间在 chrome 上无法检查?

用于复选框其他选项的 Jquery 函数