物化 - 全屏滑块和导航栏

时间:2016-03-11 13:12:20

标签: slider fullscreen navbar materialize

在项目开发期间,我决定使用全屏图像滑块。如官方网站所示:Link

通过这种方式导航栏消失了,但是在Youtube视频中,我发现有一种方式(我不知道),以便保持全屏滑块和导航栏。任何人都可以帮我解决这个问题吗?有没有办法兼顾这两个功能? 感谢。

以下是代码:

<!DOCTYPE html>
<html>

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
    <script src="./script.js"></script>
    <!-- Compiled and minified CSS -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">

        <!-- Compiled and minified JavaScript -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js"></script>
        <script src="./src/jquery.js"></script>
        <script src="./src/js.js"></script>
        <title>Home Automation - Test</title>
        <meta charset="utf-8" lang="it">
        <link rel="stylesheet" href="./css/mycss.css">
    </head>

<body class="bkground">
    <nav class="teal darken-1">
        <div class="nav-wrapper">
            <a href="#" class="brand-logo right">Domotic Home</a>
            <ul id="nav-mobile" class="left hide-on-med-and-down">
                <li class="active"><a href="index.html">General</a></li>
                <li><a href="homecontrol1.html">Home Control - First floor</a></li>
                <li><a href="homecontrol2.html">Home Control - Second floor</a></li>
                <li><a href="privatearea.html">Private Area</a></li>
            </ul>
        </div>
    </nav>
    <br>
    <br>
    <div class="slider fullscreen">
        <div class="main-content">
            <ul class="slides">
                <li>
                    <img src="./img/1.jpg">
                </li>
                <li>
                    <img src="./img/5.jpg">
                </li>
                <li>
                    <img src="./img/3.jpg">
                </li>
                <li>
                    <img src="./img/6.jpg">
                </li>
                <li>
                    <img src="./img/7.jpg">
                </li>
                <li>
                    <img src="./img/9.jpg">
                </li>
                <li>
                    <img src="./img/11.jpg">
                </li>
                <li>
                    <img src="./img/12.jpg">
                </li>
                <li>
                    <img src="./img/13.jpg">
                </li>
                <li>
                    <img src="./img/14.jpg">
                </li>
                <li>
                    <img src="./img/15.jpg">
                </li>
                <li>
                    <img src="./img/16.jpg">
                </li>
            </ul>
        </div>
    </div>
</body>

</html>

这里是css

.modal {
    max-height: 90%;
    max-width: 90%;
}
.bkground {
    background-image: url("/img/Sfondo3.jpg")
}
.sliderimg {
    border-color: black;
    border: solid 2px;
}
.floorimg {
    border-color: black;
    border: solid 4px;
}
.main-content {
    top: 100%;
    position: absolute;
    width: 100%;
}

4 个答案:

答案 0 :(得分:2)

我找到了答案

  

CSS

.slider-adjustment{
 position: fixed;
  top: 56px;  <!-- as nav bar has height of 56px -->
  left: 0;
  bottom: 0;
  right: 0;
  overflow: auto;
background-color:cyan ;

}
  

HTML

 <div class="slider-adjustment">
     <!-- All html for slider goes here -->
 </div>

答案 1 :(得分:0)

烨。它可以完成。我在div.slider.fullscreen之后添加了一个div.main-content,如下所示:

div.main-content {
            top: 100%;
            position: absolute;
            width: 100%;
        }

它对我有用。只需在div.main-content元素中添加您想要的任何内容

答案 2 :(得分:0)

您是否尝试过增加z-index

nav{
  z-index:100;
}

答案 3 :(得分:0)

您可以将全屏滑块后的所有内容包装在div中(例如ID为 内容),然后将CSS设置如下:

#content {
position: relative;
top : 100vh;
}

积分:https://github.com/anshap1719