Dynamic graphic with integrated navigation menu

I'm looking to achieve a similar design concept like the one on this website:

The navigation bar should remain fixed at the bottom of the window until you start scrolling.

I am unsure if this can be done using just CSS, but I have made some progress with the following code:

HTML

<div class="container">

<ul class="jquery slideshow">
  <li><img src="01.jpg" /></li>
  <li><img src="01.jpg" /></li>
</ul>

<div class="jquery navbar">
        <div class="inner">
            <a href="#s1" class="subNavBtn" id="s1">Section 1</a> 
            <a href="#s2" class="subNavBtn" id="s2">Section 2</a>
            <a href="#s3" class="subNavBtn" id="s3">Section 3</a>
            <a href="#s4" class="subNavBtn" id="s4">Section 4</a>
            <a href="#s5" class="subNavBtn" id="s5">Section 5</a>
        </div>
    </div>
</div>

CSS

.container{
    width:100%;
}

Currently, there is a slideshow and a navigation bar below it spanning the full width. My goal now is to make them responsive to fit any window size seamlessly.

Answer №1

By utilizing the power of CSS alone, you can achieve this effect without relying on jQuery. Utilize the calc function to make it happen:

.slideshow {
    height:calc(100% - 100px);
}

.navbar {
    height:100px;
}

This approach informs the browser that the navigation bar should be 100 pixels tall (adjust as needed), while the slideshow will fill the remaining window height after subtracting the 100 pixels from the navbar's height. This setup ensures that the navigation bar stays fixed at the bottom of the page.

UPDATE: After testing locally, everything functions correctly. However, when attempting to showcase it on jsfiddle, an issue arises. The code works seamlessly on IE and Chrome with the following adjustments:

UPDATE 2: I discovered the root cause of the problem. It turns out I omitted the doctype declaration. Once the doctype is added along with specifying the heights for the container and body elements, the solution functions flawlessly. Check out this JSFiddle demo for a working example.

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

Finding your way to a <div data-role="page"> sans the use of an anchor tag

I need assistance with a specific HTML setup. The first div tag in the code below contains a form with a table that has two columns labeled A and B, along with a button. The second div tag holds a text box, dropdown menu, and submit button. When the button ...

Guide to combining two jQuery scripts that utilize distinct data types

Working collaboratively with Tomas, progress has been made on this issue. Here is the updated code: The purpose of this script is to send a query string to the server for parsing and database insertion. Upon successful completion of the class method, a 100 ...

Formatting that differs based on whether the content appears on the left

I'm in search of a solution to align specific items to the left on left-hand pages and to the right on right-hand pages. I have come across @page :left/:right, but it seems to only affect the page layout and margins, not the actual content on the page ...

AngularJS and Spring Rest team up for seamless drag-and-drop file uploads

I have successfully implemented file upload using AngularJS and Spring REST, but now I want to change it to use dropzone.js or any other drag and drop file upload method. I tried using the dropzone.js library, but I am facing issues integrating it with Ang ...

The loop in MVC is not functioning properly when dealing with various MapRoutes

I am new to MVC and have a good understanding of C#. While experimenting with MVC in Visual Studio, I encountered an issue that is puzzling me. I am struggling to identify the cause of this error. My goal is to print a variable n number of times. It works ...

jQuery SlideUp and SlideDown causing Margin Bug in Internet Explorer 7

When clicking the "more info" or "less info" buttons to slide content up or down, a spacing glitch is created in IE7. Using show/hide instead of slideUp/slideDown seems to solve the issue. Is there a way to make sliding work in IE7 without causing this pro ...

Changing the class of an element in Svelte: A step-by-step guide

I am working on a svelte application and I want to implement row highlighting when a user clicks on it. Here is an example code snippet that demonstrates this functionality: <div id="A" class="car-even">A</div> <div id=&q ...

You are receiving a TypeError because the unbound method move_to_element() should be called with an instance of ActionChains as the first argument, but instead it was given a

Currently, I am using the latest version of selenium with Python 2.7.8. When trying to perform a drag and drop action onto a <div id="droppable"> element using jQuery UI, I encountered the following error message: TypeError: unbound method move_to_el ...

Error in Angular 2: The app.component.html file triggered an exception at line 1, character 108 due to excessive recursion

After successfully setting up the Angular 2 quickstart and connecting to an express server, I encountered a problem when switching from using the template property to component templateUrl. I have created a Plunker to showcase this issue: Plunker Demo imp ...

Transforming a form containing recurring elements into JSON

Sorry if this topic has already been discussed, I wasn't able to locate any information I currently have an html form structured like so: <form> <div> First Name <input name="FirstName" type="text"> Age <input name="Age" t ...

Running Jest tests on an ajax request leads to an error involving the undefined $ variable

We are currently in the process of integrating Jest testing into our existing project, but we have encountered some difficulties. Specifically, we are trying to test the functionality of the following function: // Send picture function sendESGPIC(results) ...

Is there an issue with JQM plugin due to jQuery's append() function?

I am just starting to learn about jQuery mobile as I develop an app using it. Whenever I click on the Add_details button, I want to add dynamic input fields only once. After saving, if I click on the Add_details button again, I need to append more dynamic ...

What is the best way to set a textbox as read-only using jQuery?

Seeking guidance on how to make a textbox readonly using a combination of knockout and jquery. Any advice on achieving this in either knockout or jquery would be appreciated. ...

Utilizing React to transform object data into table columns

I need assistance mapping the following object array into table columns using react. The table has 4 columns, and I want these values to be displayed in them. There are also two rows that need to be filled out. <table> <tbody> ...

How can you enable a button to be clicked from within a drawer?

Hey there, I've got a div that toggles hide/show like a drawer when clicked. When the drawer is in show state, it contains a button. How can I make the button clickable without toggling the drawer? Any ideas on this?! `zIndex` doesn't seem to be ...

Styling div elements to match the dimensions of table rows in CSS

When it comes to CSS, I wouldn't call myself an expert; My question is: is there a way for a div tag to inherit dimensions from specific table rows based on their class or id? For instance: Imagine we have a table with multiple rows, but we don&apos ...

What is causing this element to unexpectedly elongate when I hover on it, despite having a 3D rotation effect applied?

After implementing a rotational hover effect on an element using the following code: transform: perspective(600px) rotateY(-25deg); I encountered a major issue when hovering over it. The element sometimes rotates abruptly and stretches excessively. If y ...

The grid columns are not utilizing the entire space of the rows and are extending beyond to the next line

I'm currently designing a card layout with images and aiming for uniformity in size. The plan is to have 4 columns in each row, with one card per column. Each subsequent row will also contain 4 cards. However, there seems to be an issue where the ca ...

Spooky results displayed on website from NightmareJS

Is there a way to display the output from nightmareJS onto a webpage when a button is clicked using HTML, CSS, and JS? This is my nightmareJS code: var Nightmare = require('nightmare'); var nightmare = Nightmare({ show: false}) nightmare .go ...

Are there any alternative methods to avoid duplication of Navbar link margin classes in Tailwind CSS?

It feels really repetitive to have to add margin classes to each LI manually on a non-dynamically generated menu. It almost seems as messy as using inline style attributes... Is there a more efficient way to handle this? While it may not be a big deal fo ...