如何在幻灯片图像上重叠导航菜单

时间:2015-11-01 14:54:10

标签: css html5

尝试使用绝对位置使菜单列表与幻灯片图像重叠但无法解决问题。

当我尝试更改位置时,菜单会混淆。幻灯片图像是相对的,菜单列表是绝对的。

<!DOCTYPE html>
<head>

  <title>Quantum PC Shop</title>
  <link rel="stylesheet" type="text/css" href="QuantumPCShop.css">




  <link rel="stylesheet" type="text/css" href="MangaPage.css">
  <script src="jquery-2.1.4.min.js"></script>
  <link href="owl.carousel.css" rel="stylesheet">
  <link href="owl.theme.css" rel="stylesheet">

</head>

<body>



            <!--<<<<<<<<< Nav Menu >>>>>>>>>>-->

<center>
<div class="BodyNav2">
              <div class="Menu">
              <ul  id="css3menu_middle">
                <li>New Arrival
                  <ul><li>HDD</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>
              <ul id="css3menu_middle">
                <li>Motherboard
                  <ul><li>Summary</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>
              <ul id="css3menu_middle">
                <li>Hard Disk
                  <ul><li>Summary</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>
              <ul id="css3menu_middle">
                <li>Graphic Card
                  <ul><li>Summary</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>
              <ul id="css3menu_middle">
                <li>CPU
                  <ul><li>Summary</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>
              <ul id="css3menu_middle">
                <li>PSU
                  <ul><li>Summary</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>
              <ul id="css3menu_middle">
                <li>Cooling System
                  <ul><li>Summary</li>
                      <li>Purchase History</li>
                      <li>Messages</li>
                      <li>Wish List</li>
                  </ul></li>
              </ul>

    </div>
</div>
<center>


<div class="bodyContentSlide"><br>



                <div id="owl-demo" class="owl-carousel">

                  <div class="item"><img src="Style1.jpg" alt="The Last of us"></div>
                  <div class="item"><img src="Style2.jpg" alt="GTA V"></div>
                  <div class="item"><img src="Style3.jpg" alt="Mirror Edge"></div>
                  <div class="item"><img src="Style4.gif" alt="The Last of us"></div>
                  <div class="item"><img src="Style5.jpg" alt="GTA V"></div>



                </div>


      <script src="owl.carousel.js"></script>

      <style>
      #owl-demo .item img{
          display: block;
          width: 100%;
          height: auto;
          
      }
      </style>


      <script>
      $(document).ready(function() {
        $("#owl-demo").owlCarousel({

        navigation : true,
        slideSpeed : 300,
        paginationSpeed : 400,
        singleItem : true

        });
      });
      </script>



</div>

</body>
</htmL>

div.headerArea {
  margin-top: -70px;
  height:10px;

}

div.HearderAfterBorder{
    display: inline-block;
    margin-left:-20px;
    padding-top: 50px;
}


body {
  font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  /*padding: 20px 50px 150px;*/
  font-size: 13px;
  text-align: center;
  /*margin-left:-1000px;*/
  //background: url(wallAbstrack.jpg);
  background-color: #f9f9f9;
text-shadow: 0 -1px 0 #000;

}




ul#css3menu_middle{
text-align: center;
display: inline;
margin: 0;
padding: 15px 4px 7px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);


}

.sub1{
  position: absolute;
}

ul#css3menu_middle li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 54px;
background: #EBFFD6;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
height: 7px;
top:0px;
}

ul#css3menu_middle li:hover {
background: #555;
color: #fff;

}
ul#css3menu_middle li ul {
padding: 0;
position: absolute;
top: 38px;
left: 0;
width: 173px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;

}
ul#css3menu_middle li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;

}
ul#css3menu_middle li ul li:hover { background: #666; }
ul#css3menu_middle li:hover ul {
display: block;
opacity: 1;
visibility: visible;

}


/*<<<<<<<<<<<<<<<<<<<<<< Body Content Slide >>>>>>>>>>>>>>>>>>>> */

div.BodyNav2{

}
div.bodyContentSlide{
  height:500px;
  border: 0px solid;
  width:95%;
  align-content: center;
}

Download full code/files(TestSlid)

1 个答案:

答案 0 :(得分:0)

我终于得到了答案。我们需要z-index使菜单重叠为slideShow。使用绝对位置将仅重叠图像而不是幻灯片显示js。

样品:

#cssmenu, #cssmenu ul {
line-height: 1;
list-style: none outside none;
padding: 0;
z-index: 1000;
}