css - 来自 Materialise 的视差没有显示图像

标签 css parallax materialize

我正在使用 Materialize CSS 并尝试使用 Parallax。

我按照说明操作:http://materializecss.com/parallax.html

但是当我保存时,没有图像显示。

这是代码笔:https://codepen.io/wecarrasco/pen/qmxMox

    <div class="parallax-container">
    <div class="parallax"><img src="http://www.mrwallpaper.com/wallpapers/landscape-georgia.jpg"></div>
  </div>
  <div class="section white">
    <div class="row container">
      <h2 class="header">Parallax</h2>
      <p class="grey-text text-darken-3 lighten-3">Parallax is an effect where the background content or image in this case, is moved at a different speed than the foreground content while scrolling.</p>
    </div>
  </div>
  <div class="parallax-container">
    <div class="parallax"><img src="\wecarrasco.github.io/computer.jpg"></div>
  </div>

和脚本:

<script>
    $(document).ready(function(){
      $('.parallax').parallax();
    });
</script>

谢谢!

最佳答案

我遇到了同样的问题,唯一的解决方法是添加一个 z-index: X;,其中 X 比环绕 div 高元素 z-index 所以我将 15 设置为视差 div,所以我的最终 div 是这样的

<div class="parallax-container">
    <div class="parallax" style="z-index: 15;">
        <img src="img/profile2.jpg">
    </div>
</div>

这对我有用。

关于css - 来自 Materialise 的视差没有显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43896410/

相关文章:

html - 为什么这个DIV没有收缩包装?

javascript - 视差滚动与 JQuery 动画绊倒

javascript - Materialisecss Autocomplete 上的两个 onChange 事件

html - 使整个 div 在悬停时发生变化

html -::之前和::之后不起作用

Android视差效果和View Pager

javascript - 我怎样才能解决这个视差

css - 修改Materialize.css中 ".hoverable"类的阴影颜色

html - 如何在 Materialise 表中使用复选框

javascript - 下拉 | Material 设计 |两个元素 |重叠