Navigation bar with a full-page slider

I am trying to incorporate my bootstrap nav bar into a full-width slider, similar to the layout in this example.

https://i.sstatic.net/LE9wP.jpg

This is the full width slider 

http://codepen.io/grovesdm/pen/MazqzQ

Currently, I have positioned the nav bar at the top and added the slider code afterwards. However, the result is not what I expected.

https://i.sstatic.net/jxqCZ.png

When I remove the background color of the nav bar and try to make it transparent, nothing changes. How can I properly position the slider within the nav bar?

Answer №1

It seems like this is what you're looking for:

/*! http://mths.be/slideshow v1.0.0 by @mathias */ ;
(function($) {
  $.fn.slideshow = function(options) {
    options = $.extend({
      'timeout': 3000,
      'speed': 400 // 'normal'
    }, options);
    // Loop through selected elements to handle multiple slideshow calls
    return this.each(function() {
      var $elem = $(this); 
      $elem.children().eq(0).appendTo($elem).show(); 
      setInterval(function() { 
        $elem.children().eq(0)
          .hide().appendTo($elem)
          .fadeIn(options.speed) 
      }, options.timeout); 
    }); 
  }; 
}(jQuery)); 

// Initialize the slider

$(function() {
  $('.slider').slideshow({ 
    timeout: 7000, 
    speed: 1000
  }); 
});
* {
  padding: 0;
  margin: 0;
}
.slider {
  position: relative;
  width: 100%;
  height: 100vh;
} 
.slider li {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%; 
  display: none; 
  list-style: none;
}
.slider li .slide {
  background-size: cover; 
  background-position: center center; 
  height: 100%; 
  width: 100%; 
} 
.slider li .slide figcaption {
  font-family: sans-serif; 
  text-transform: uppercase; 
  letter-spacing: -1px; 
  color: white; 
  text-shadow: 0 0 5px black; 
  font-size: 60px; 
  text-align: center; 
  position: absolute; 
  top: -30px; 
  margin-top: 50vh; 
  left: 0; 
  right: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

<body>
<section>
  <nav class="navbar navbar-fixed-top">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">Project name</a>
      </div>
      <div id="navbar" class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
          <li class="active"><a href="#">Home</a>
          </li>
          <li><a href="#about">About</a>
          </li>
          <li><a href="#contact">Contact</a>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li><a href="#">Action</a>
              </li>
              <li><a href="#">Another action</a>
              </li>
              <li><a href="#">Something else here</a>
              </li>
              <li role="separator" class="divider"></li>
              <li class="dropdown-header">Nav header</li>
              <li><a href="#">Separated link</a>
              </li>
              <li><a href="#">One more separated link</a>
              </li>
            </ul>
          </li>
        </ul>
      </div>
      <!--/.nav-collapse -->
    </div>
  </nav>

  
    <ul class="slider">
      <li>
        <figure class="slide" style="background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/260511/1d9326c2ae66befef4e39c3426adf17a.jpg)">
          <figcaption>hello</figcaption>
        </figure>
      </li>
      <li>
        <figure class="slide" style="background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/260511/______by_Thoum.jpg)">
          <figcaption>yeah</figcaption>
        </figure>
      </li>
      </li>
    </ul>
  </section>

  <p>Hello</p>
</body>

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

Tips for integrating TypeScript with Vue.js and Single File Components

After extensive searching online, I have struggled to find a straightforward and up-to-date example of setting up Vue.js with TypeScript. The typical tutorials out there either are outdated or rely on specific configurations that don't apply universal ...

A guide on accessing the first element in an array when performing multiplication within the Interval component in React.js

I am having trouble initiating an if statement from number 0 once the window is loaded, as it seems to be skipping over 0 and starting from 1 instead. Can someone please assist me in understanding how this works? showAnime = () => { let counter ...

Unable to render data in Chart JS using PHP JSON

Hello, I’m currently working on creating a dynamic line chart using Chartjs. The data is being pulled from an SQL database using PHP in JSON format. Although the data is successfully retrieved, the chart appears blank. Any assistance would be greatly app ...

Adjusting the margins of jQuery mobile buttons

I seem to be stuck on a simple error that is causing me to spin my wheels. Take a look at the following jqm (version 1.3) view (in haml) #main-header{'data-role' => 'header'} #main-content{'data-role' => 'content ...

Ways to design siblings that are not currently being hovered over

Is there a way to achieve an effect where hovering over one list item causes all other list items to fade out? I'm searching for a method to style an element that is not being hovered, when one of its siblings is in the hovered state. I've trie ...

Testing Angular 2: Ensuring Component Properly Calls Router with Accurate Arguments

I'm facing an issue with a child component that includes a button element with 'routerlink' attribute for navigation upon clicking. The button does not have a '(click)' handler, only the routerlink. Currently, I am writing a unit ...

Exploring methods for testing an HTML page that utilizes jQuery for DOM manipulations

Recently, I was tasked with creating an HTML page that utilized jQuery DOM manipulations. For instance, upon clicking the submit button, a success or error message should be displayed. Testing these functionalities is something I'm familiar with in An ...

Changing the background color of a table cell using PHP based on data retrieved from a database table

Currently, I am developing an attendance system where users can mark their attendance. Additionally, the page contains a calendar displaying the current month. My objective is to modify the color of table cells based on the attendance status: 1. Green fo ...

assign the loading screen image to a swf file

I have an HTML file that includes a 3MB SWF flash intro. I would like to display a loading preloader using jQuery or AJAX until the SWF is fully loaded. Can you please provide the code to set up this preloader? Thank you in advance. Here is the code I a ...

The width of the unordered list is not what I defined

when I set this line: <ul style="width:100px; height:100px; background-color:green"> <li style="width:100px; height:100px; border:1px solid blue"> 1 </li> </ul> The ul ends up wider than my specified 100px width. Any thoughts ...

Three.js - Optimizing and Handling Images - Best Practices

My current project has a unique concept: https://i.sstatic.net/Jd3Ot.jpg The main idea revolves around a virtual room that dynamically adjusts its height based on the number of images loaded by the user. While it functions smoothly with fewer pictures, ...

Creating a stylish flyout search box using CSS

I am looking to create a search box that pops up when a button is clicked and disappears when clicked outside. My approach involves using CSS to achieve this functionality. Here is the HTML structure I am working with: <div tabindex="0" class="search" ...

Utilizing property validation in your codebase

How can I set up my code to display a warning in the console if the value of the Prop is not a string? The player-name prop should always be a string. If this: <greet :player-name="5"></greet> contains a number, I want my code below to generat ...

Printing JSON data with multiple rows in HTML

How can I display multiple rows returned by JSON using my JavaScript function? function getScheduleDate() { //alert("enters1"); //var usrname= getParameterByName('uname'); var postVal=$.post('http://localhost/ipack/salesvisit.ph ...

How to effectively manage draggable items or remove draggable data properly

I am looking to make certain objects draggable, however, the set of objects varies every time. How can I clear the draggable data from the previous set? P.S. When I use $('.draggable').draggable('destroy');, it gives me an error saying ...

Leveraging Webpack for the exclusive creation of a vendor bundle

Presently, our AngularJS project relies on Bower for front-end dependencies and the bower-concat Grunt task to merge bower_components into a single libraries.js file. Similarly, we assemble library CSS files into a libraries.css. Looking ahead, we aim to ...

The Javascript function is designed to function exclusively with onclick events or setTimeout functions

I am currently working on a website that I want to be responsive to the window size. However, I am facing an issue with vertical alignment. I have created a jQuery function to handle this, and it works well for divs with images but not so well for a div wi ...

The return value of a jQuery post request is consistently false

When I click on a tag, my code returns true but the data variable is false. Can you explain why this is happening? $('#AddProvince').click(function () { var url = '@Url.Action("SetProvinceList")'; var id = $('#Province&apo ...

Firefox not responding to jQuery focus() function, but Chrome is executing it flawlessly

I have been searching for a solution to this issue for hours now, as I am aware that similar questions have been asked before. The problem at hand is that I have a table cell that displays a text gig of text. However, upon clicking the cell, the text shoul ...

Only the first Yii ajax jQuery request is successful when multiple requests are made

There seems to be an issue with my input field and button pairs for ajax requests. The functionality works fine the first time, but after that initial request-response cycle, the other buttons don't trigger the ajax function. I have a data grid list ...