简体   繁体   English

与Muuri Grid一起使用时,Materialize CSS Material Box z-index不起作用

[英]Materialize CSS Material Box z-index doesn't work when used with Muuri Grid

When I use Material Box from Materialize along with Muuri grid items, the maximized Material Box will still display behind the subsequent Muuri grid items even though the Material Box's z-index is set high. 当我用料箱Materialise公司连同Muuri电网项目,最大化的料箱仍会显示,即使物料箱的z-index的设置为高以后Muuri电网项目背后。

Here's my plunker example https://plnkr.co/edit/aM2427AEwuWIqV3N9GvE/ . 这是我的小矮人示例https://plnkr.co/edit/aM2427AEwuWIqV3N9GvE/

In the example, if you click on box three it appears to work, but if you click on boxes one and two you will see that they will still have the other boxes overlapping them. 在示例中,如果单击第三个框,它似乎可以工作,但是如果单击第一个框和第二个框,您将看到它们仍将其他框重叠。

Here's the CSS: 这是CSS:

.grid {
  position: relative;
}

.item {
  display: block;
  position: absolute;
}

.item-content {
  position: relative;
  width: 100%;
  height: 100%;
}

Here's the HTML: 这是HTML:

<div class="grid">
  <div class="item">
    <div class="item-content">
      <img class="materialboxed" src="https://via.placeholder.com/270x350/ffab91/?text=one" />
    </div>
  </div>
  <div class="item">
    <div class="item-content">
      <img class="materialboxed" src="https://via.placeholder.com/270x350/90caf9?text=two" />
    </div>
  </div>
  <div class="item">
    <div class="item-content">
      <img class="materialboxed" src="https://via.placeholder.com/270x350/80cbc4/?text=three" />
    </div>
  </div>
</div>

Here's the JavaScript: 这是JavaScript:

$(function() {
  var grid = new Muuri('.grid');
});

I just created a new example from your code and it's working fine. 我刚刚从您的代码创建了一个新示例,并且工作正常。 Hope this will help! 希望这会有所帮助!

here is the link to that example MUURI EXAMPLE 这是该示例的链接MUURI示例

code: 码:

HTML 的HTML

<div class="grid">

    <div class="item">
      <div class="item-content">
        <img class="materialboxed" src="https://via.placeholder.com/270x350/ffab91/?text=one" />
      </div>
    </div>

    <div class="item">
      <div class="item-content">
        <img class="materialboxed" src="https://via.placeholder.com/270x350/90caf9?text=two" />
      </div>
    </div>

    <div class="item">
      <div class="item-content">
        <img class="materialboxed" src="https://via.placeholder.com/270x350/80cbc4/?text=three" />
      </div>
    </div>

  </div>

CSS 的CSS

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #fcfaf9;
}

.grid {
  position: relative;
}

.item {
  display: block;
  position: absolute;
  height: 200px;
  width: 200px;
  line-height: 200px;
  margin: 5px;
  text-align: center;
  z-index: 1;
}

.item.muuri-item-dragging {
  z-index: 3;
}

.item.muuri-item-releasing {
  z-index: 2;
}

.item.muuri-item-hidden {
  z-index: 0;
}

.item-content {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  color: #fff;
  background: #59687d;
  font-size: 40px;
  text-align: center;
}

.item.muuri-item-dragging .item-content {
  background: #8993a2;
}

.item.muuri-item-releasing .item-content {
  background: #152c43;
}

JS JS

const grid = new Muuri(".grid", {
  dragEnabled: true
  // dragAxis: 'y'
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM