my slideshow is mounted to my menu in HTML

2

I am developing a web page. This has a menu and below it there is a slideshow but at the moment of squashing down the slideshow is superimposed on the menu and I do not know why that happens.

ccs

CSS DEL MENU: 
* {
  margin: 0;
  padding: 0;
}

body {
  background: #fffffa;
}

header {
  width: 100%;
  overflow: :hidden;
  background: #252932;
  margin-bottom: 20px;
}

.weapper {
  width: 90%;
  max-height: 160px;
  margin: auto;
  overflow: hidden;
}

header .logo {
  color: #f2f2f2;
  font-size: 50px;
  line-height: 200px;
  float: left;
}

header nav {
  float: right;
  line-height: 200px;
}

header nav a {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  line-height: normal;
  font-size: 20px;
  font-weight: bold;
  -webkit-transition: all 500ms ease;
  -o-transition: all 500ms ease;
  transition: all 500ms ease;
}

header nav a:hover {
  background: #f56f3A;
  border-radius: 50px;
}

.header2 {
  position: fixed;
  height: 100px;
}

.header2 .logo {
  line-height: 100px;
  font-size: 30px;
}

.header2 nav {
  line-height: 100px;
}

.contenido p {
  margin-bottom: 1em;
}

@media screen and (max-width: 950px) {
  header .logo,
  header nav {
    width: 100%;
    text-align: center;
    line-height: 100px;
  }
  .header2 {
    height: auto;
  }
  .header2 .logo .header2 nav {
    line-height: 50px;
  }
}














css del slideshow:
* {
margin:0;
padding:0;
}
 
body {
background:#f2f2f2;

}
 
.main {
width:90%;
max-width:1000px;
margin:20px auto;

}
 
.slides {
width:100%;

}
 
.slides img {
width:100%;
}
 
.slidesjs-pagination {
background:#424242;
list-style:none;
overflow:hidden;
}
 
.slidesjs-pagination li {
float:left;
}
 
.slidesjs-pagination li a {
display:block;
padding:13.5px 20px;
color:#fff;
text-decoration:none;
}
 
.slidesjs-pagination li a:hover {
background:#000;
}
 
.slides .active {
background:#000;
}
 
.slidesjs-navigation{
background:#000;
color:#fff;
text-decoration:none;
display:inline-block;
padding:13.5px 20px;
float:right;
}
HTML:
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>DOCUMENT</title>
  <link rel="stylesheet" type="text/css" href="menu.css">
  <link rel="stylesheet" type="text/css" href="slideshow.css">
  <link rel="stylesheet" type="text/css" href="font.css">

  <script src="http://code.jquery.com/jquery-latest.js"></script>
  <script src="header.js"></script>
</head>

<body>
  <header>
    <div class="weapper">
      <div class="logo">
        Reynaldo.inc
      </div>


      <nav>
        <a href="#">INICIO</a>
        <a href="#">SERVICIOS</a>
        <a href="#">PROYECTOS</a>
        <a href="#">CONTACTOS</a>

      </nav>
    </div>


  </header>

  <div class="main">
    <div class="slides">
      <img src="Galeria/balloon_sky_flight_sunset_clouds_119652_800x600.jpg">

      <img src="Galeria/piopio_new_zealand_mountains_rocks_grass_evening_119665_800x600.jpg">

      <img src="Galeria/singapore_building_night_city_119649_800x600.jpg">

      <img src="Galeria/sneakers_legs_red_mountains_119647_800x600.jpg">

      <img src="Galeria/traffic_lights_indicator_sign_119607_800x600.jpg">
    </div>

  </div>
  <script src: "jquery-1.9.1.min.js"></script>
  <script src="js/jquery.slides.js"></script>
  <script>
    $(function() {
      $(".slides").slidesjs({
        play: {
          active: true,

          effect: "slide",

          interval: 3000,

          auto: true,

          swap: true,

          pauseOnHover: false,

          restartDelay: 2500
        }
      });
    });
  </script>

  <section class="contenido weapper">


  </section>
</body>

</html>

header.js $ (document) .ready (function () {

$(window).scroll(function(){
    if( $(this).scrollTop() > 0 ){
        $('header').addClass('header2');
    } else {
        $('header').removeClass('header2');
    }
});

});

    
asked by reynaldo chavez 23.02.2018 в 17:00
source

3 answers

1

This seems like a problem with the order of the elements on your page and should be able to be solved by assigning the appropriate z-index values.

Try adding a value of z-index that is high to header (or to the class .header2 which is the one that is added when you scroll on the page) so that it is above the slideshow:

.header2 {
  z-index: 99999;
}
    
answered by 23.02.2018 в 18:36
1

It's very easy, it's a matter of z-index.

Add to the class .main a position: relative; z-index: 1; and to the header a z-index: 10 or 9, or 9999, the important thing is that it is greater than 2.

And now, look:

$(document).ready(function(){

$(window).scroll(function(){
    if( $(this).scrollTop() > 0 ){
        $('header').addClass('header2');
    } else {
        $('header').removeClass('header2');
    }
});
});
CSS DEL MENU: 
* {
  margin: 0;
  padding: 0;
}

body {
  background: #fffffa;
  font-family: arial;
}

header {
  width: 100%;
  overflow: :hidden;
  background: #252932;
  margin-bottom: 20px;
}

.weapper {
  width: 90%;
  max-height: 160px;
  margin: auto;
  overflow: hidden;
}

header .logo {
  color: #f2f2f2;
  font-size: 50px;
  float: left;
}

header nav {
  float: right;
}

header nav a {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  line-height: normal;
  font-size: 20px;
  font-weight: bold;
  -webkit-transition: all 500ms ease;
  -o-transition: all 500ms ease;
  transition: all 500ms ease;
}

header nav a:hover {
  background: #f56f3A;
  border-radius: 50px;
}

.header2 {
  position: fixed;
  top: 0;
  z-index: 10;
}

.header2 .logo {
  font-size: 2em;
}

.contenido p {
  margin-bottom: 1em;
}

.slides,
.slides *{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@media screen and (max-width: 950px) {
  header .logo,
  header nav {
    width: 100%;
    text-align: center;
  }
  .header2 {
    height: auto;
  }
  .header2 .logo .header2 nav {
    line-height: 50px;
  }
}














css del slideshow:
* {
margin:0;
padding:0;
}
 
body {
background:#f2f2f2;

}
 
.main {
width:90%;
max-width:1000px;
margin:20px auto;
position: relative;
z-index: 1;
}
 
.slides {
width:100%;

}
 
.slides img {
width:100%;
}
 
.slidesjs-pagination {
background:#424242;
list-style:none;
overflow:hidden;
}
 
.slidesjs-pagination li {
float:left;
}
 
.slidesjs-pagination li a {
display:block;
padding:13.5px 20px;
color:#fff;
text-decoration:none;
}
 
.slidesjs-pagination li a:hover {
background:#000;
}
 
.slides .active {
background:#000;
}
 
.slidesjs-navigation{
background:#000;
color:#fff;
text-decoration:none;
display:inline-block;
padding:13.5px 20px;
float:right;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<body>
  <header>
    <div class="weapper">
      <div class="logo">
        Reynaldo.inc
      </div>
      <nav>
        <a href="#">INICIO</a>
        <a href="#">SERVICIOS</a>
        <a href="#">PROYECTOS</a>
        <a href="#">CONTACTOS</a>
      </nav>
    </div>
  </header>

  <div class="main">
    <div class="slides">
      <img src="http://picsum.photos/800/600?image=255">
      <img src="http://picsum.photos/800/600?image=254">
      <img src="http://picsum.photos/800/600?image=257">
      <img src="http://picsum.photos/800/600?image=251">
      <img src="http://picsum.photos/800/600?image=247">
    </div>

  </div>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/slidesjs/3.0/jquery.slides.min.js"></script>
  <script>
    $(function() {
      $(".slides").slidesjs({
        play: {
          active: true,
          effect: "slide",
          interval: 3000,
          auto: true,
          swap: true,
          pauseOnHover: false,
          restartDelay: 2500
        }
      });
    });
  </script>
  <section class="contenido weapper">


  </section>
</body>

</html>
    
answered by 24.02.2018 в 05:32
0

In your style sheet define a class that has the measurements, colors and formats that you want for your menu, and on your website always divides everything by divs.

For example:

In your style sheet define the classes you need:

.top-bar {
  display: -ms-flexbox;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  .top-bar .top-bar-left,
  .top-bar .top-bar-right {
    -ms-flex: 0 0 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }
}

And on your web page separate everything by divs:

<div class="top-bar">
    <div class="top-bar-left"></div>
    <div class="top-bar-right">
        <ul class="menu vertical medium-horizontal">
            <li><a style="font-weight:bold" href="#">HOME</a></li>
            <li><a style="font-weight:bold" href="#">PAGES</a></li>
        </ul>
    </div>
</div>

<div>
    ...Aquí pon tu slideshow
</div>
    
answered by 23.02.2018 в 17:35