Is there a way to prevent the page's navbar from getting hidden under the slide animation? I want to display the navbar separately at the top, with animations working as usual

I'm struggling with getting my navigation bar to work properly alongside a slide animation. No matter what I try, the navbar keeps overlapping. Here's the code I have so far:

Here is the HTML section:

Navbar section:

    <ul class="slideshow">
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
    </ul>

This is the CSS section:

    body {
      background-color: #000;
    }

    #landing-header {
      z-index: 1;
      position: relative;
      text-align: center;
      padding-top: 40vh;
    }

    #landing-header h1 {
      color: #fff;
    }

    .slideshow { 
        position: fixed;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 0;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .slideshow li { 
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
        background-size: cover;
        background-position: 50% 50%;
        background-repeat: no-repeat;
        z-index: 0;
        animation: imageAnimation 50s linear infinite;
    }


    .slideshow li:nth-child(1) { 
        background-image: url();
    }



    @keyframes imageAnimation { 
      0% { 
        opacity: 0; 
        animation-timing-function: ease-in;
      }
      10% {
        opacity: 1;
        animation-timing-function: ease-out;
      }
      20% {
        opacity: 1
      }
      30% {
        opacity: 0
      }
    }

Answer №1

After reviewing your requirements, I would appreciate more details or a live demonstration if possible.

Here is a straightforward solution for creating a sticky navbar that remains at the top of the page and above all other elements:

body {
  background-color: #000 !important;
}

ul {
  list-style: none;
  display: inline-flex;
}

ul.slideshow li {
  margin: 0 20px;
}

.slideshow {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 20px;
  background-color: #fff;
  z-index: 10000;
}

p {
  color: #fff;
  margin-left: 20px;
  margin-bottom:30px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>


<ul class="slideshow">
  <li>MENU</li>
  <li>MENU </li>
  <li>MENU</li>
  <li>MENU </li>
  <li>MENU</li>
</ul>

<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>

Click here to see the live demonstration: https://jsfiddle.net/Devel0per95/wgrsvx7k/11/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using CSS nth-of-type on the same level of the DOM allows for specific

I was having trouble using the nth-of-type(2n+1) selector to target odd and even rows in the scenario below. What I wanted was for the nth-of-type selector to apply different styles to the odd rows with the classes "row-data row-header" and "row-data row-c ...

Can we find a solution to optimize "Crystal Reports" for mobile browsers and make it responsive?

I'm in the process of making my entire Asp.net application responsive for mobile browsers by utilizing Bootstrap. However, I've encountered a challenge with making Crystal Report responsive for mobile browsers. If anyone has any advice on how to ...

Creating a Thrilling Triple Image Transformation on Hover using Material-UI

Here is a Codepen showcasing a triple hover effect on an image: Codepen I attempted to recreate this effect as a styled component in React Typescript using MUI and MUI Image, but encountered an error with my styling that is preventing it from working in m ...

The Bootstrap card is elegantly framed by a crisp white border surrounding the

After referencing a tutorial, I implemented the following code: <div class="card" style="width:400px"> <img class="card-img-top" src="image.png" alt="Card image"> <div class="card-body"> <h4 class="card-title">John Doe</ ...

Challenges with Aligning Panels in Column 6

My initial encounter with bootstrap was interesting. I attempted to have two panels placed side by side using the col-lg-6 class. The left panel was meant to be a link to an article, along with an image, while the right panel would serve as a signup/login ...

What could be the reason behind ejs not allowing if else statements when the variable is undefined?

I am attempting to replicate a rather simple example from this question here <div <% if (page_name === 'overview') { %> class="menu__menu-overviewPage menu" <% } %> class="menu"> However, when I try it on a ...

What is the best way to use scrollIntoView() to display an additional item at the top or bottom of the visible area

When implementing scrollIntoView() with navigation buttons (up and down), I aim to display two items at a time to signal to the user that there are more items to navigate. However, the first and last items should retain their default behavior so the user u ...

Ways to eliminate bottom margin of text area in vuetify

Greetings, I am facing an issue with the following code snippet: <v-text-field :rules="rules" v-model="exam.title" class="exam-title ma-0 pa-0" ></v-text-field> <v-text-field class="exam-title ma-0 pa-0"></v-text-field& ...

What methods are available to create a transition animation for an HTML 5 banner on iOS devices?

I need assistance with animating an HTML5 banner to transition vertically onto the screen in my app demo. After a prompt that triggers a server callback, the banner should smoothly move down from the top of the screen. The animation I am aiming for is simi ...

Aligning divs, prevent duplicate HTML within multiple divs

Currently, I am attempting to troubleshoot a jsfiddle issue. The main problem lies in my desire for the first two divs (with class="fbox") to be aligned next to each other on the same level. Furthermore, I am looking to enable dragging the image into the ...

Adding an additional stroke to a Material-UI Circular Progress component involves customizing the styling properties

I am attempting to create a circular progress bar with a determinate value using Material-UI, similar to the example shown in this circular progress image. However, the following code does not display the additional circle as the background: <CircularP ...

CSS media queries to exclude a property for mobile devices

I have a CSS class with the width property set to calc(100% - 17px). However, I want to ignore this property completely for devices with specific resolutions. I've tried using media queries and values like initial, inherit, and unset for the width pro ...

The background image constantly shifts while scrolling on a mobile device

Just sharing my first post here. There's been something bothering me on my personal website for quite some time. Whenever I visit the site on my Android phone and start scrolling through the page, the background image seems to 'adjust' itse ...

Toggle the display of slide numbers in RMarkdown xaringan / reveal.js presentations

In preparation for a workshop, I am creating HTML slides using the xaringan package in R, which is based on remark.js. These slides are made with RMarkdown, and while this approach has been effective, I have encountered a need to disable slide numbers on s ...

What is the smoothest way to animate price changes as you scroll?

After searching online, I could only find a version for swift. The only keyword that resulted in a search was ScrollCounter. Is it possible to create this type of animation using CSS and HTML? If anyone knows of a helpful resource or example, please share ...

Obtaining the selected value from a material select dropdown in a react application

Struggling to retrieve the value from a select drop-down using onChange event in react, but the function isn't triggering. handleInputChange(event) { alert("testing") event.persist(); this.setState((state) => { state.registerForm[event ...

Ensuring that the two columns in a responsive grid have equal heights is essential for maintaining a

I am currently working on a responsive website with a main content area (.content-wrapper) and a sidebar area (.search-listing). My goal is to make sure that both columns have the same height. I attempted to achieve this using the following jQuery code: j ...

Header escapes div and continues to move

I am currently working on building a website. One of the key features I want to include is a fixed top bar that remains visible at all times. In this bar, I have added buttons, an image, and a headline. However, I am facing an issue where the headline keep ...

Steps for eliminating a column from a table

By including the detailPanel option, a new column with an icon button will be automatically added. https://i.sstatic.net/RoNue.png Is there a way to eliminate this additional column that is generated? Appreciate your help! ...

Creating a Multilevel Dropdown Menu: A Step-by-Step Guide

I am curious about how to create a multilevel dropdown menu using Bootstrap 5 and vanilla JavaScript. I created an example based on the Bootstrap 5 dropdowns component documentation, but it did not display when I clicked on it. The issue seems to be relat ...