【问题标题】:Packery/Masonry grid full width包装/砌体网格全宽
【发布时间】:2017-03-01 12:37:35
【问题描述】:

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

这是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中添加属性margin:auto;
  • 是的,我之前尝试过,没有任何变化。
  • 你能在下面试试我的答案吗

标签: jquery html css image masonry


【解决方案1】:

在你的 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;
}

【讨论】:

  • 没用,但为尝试而欢呼。这与网格项宽度有关。我一直在寻找其他类似的问题,但找不到任何问题!
【解决方案2】:

我已将网格项宽度设置为 33.3%,这似乎目前可行。但是网格元素周围还有一条细线吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多