When applying a blur filter, the fixed navbar vanishes from view

Is there a way to add a blurred background for Bootstrap 4 modals?

I had the idea of wrapping everything on the site in one container (navbar, content, and footer), and then applying filter:blur(4px) to it when body.modal-open is activated.

However, I ran into an issue with a fixed navbar - when you open a modal while scrolled halfway down the page, the navbar disappears completely.

Does anyone know why this happens or how to resolve it?

This is the structure of the HTML:

<div id="content-container">
    <nav class="navbar fixed-top">
        <!--some nav elements -->
    </nav>
    <main>
        <!-- content goes here -->
    </main>
    <footer>
        <!-- some footer -->
    </footer>
<div>
<div id="modal-container">
    <!-- Modals go here -->
<div>

Here is the CSS used:

body.modal-open #content-container{
    filter: blur(4px);
    -webkit-filter: blur(4px);
    -moz-filter: blur(4px);
    -o-filter: blur(4px);
    -ms-filter: blur(4px);
}

You can view a sample on codepen: https://codepen.io/danmoreng/pen/WVpzOm

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 jQuery to add or remove multiple classes at once

My navigation tabs use jQuery to add and remove classes for the active tab. However, I'm facing an issue where the active class is not removed when a new tab is clicked or when the user scrolls to a new section. Please refer to the following gist for ...

Leverage Bootstrap for your Vapor project

I'm just starting out in web development and have been struggling to find a definitive answer. Can Bootstrap be used in Vapor with Swift 3? ...

The spacing in a nested flexbox form gets distorted due to CSS3 styling

Working on creating a flexbox form where labels and inputs are on the same line. Have successfully achieved the desired layout using flex properties like flex-basis. However, encountered an issue when trying to nest the flexbox within an element with a fi ...

When using jQuery and dragging a list item from an ordered list, the numbering of the items following it consistently increments by 1

Despite the jQuery sortable widget functioning well in most situations, there is a glitch when dealing with an ordered list. Specifically, the numbering becomes jumbled up during element dragging. An example program is provided below to demonstrate this is ...

Angular 2 is all about managing validation messages within controls

I'm currently facing challenges with getting validation messages to display properly in Angular 2. The frequent updates to Angular 2 have made it difficult to find a simple and effective solution online, so please refrain from marking this as a duplic ...

Deactivating the submit button after a single click without compromising the form's functionality

In the past, I have posed this question without receiving a satisfactory solution. On my quiz website, I have four radio buttons for answer options. Upon clicking the submit button, a PHP script determines if the answer is accurate. My goal is to disable t ...

Check to see if a value is present in JavaScript and proceed with submitting the form

I have a situation where I am trying to capture the browser location and post it to another page. The problem I'm facing is that JavaScript takes some time to retrieve the browser location, causing the form to be submitted before the location is obtai ...

Changing div height with scrolling

I am looking to dynamically increase the height of a div as the user scrolls through the page. You can see the site I am working on here: The specific div that needs its height adjusted is the menu located on the right side of the page. I have developed ...

Is there a way to prevent the content in the <p> tag from wrapping and hiding its overflow?

Is there a way to use tailwindcss to ensure that the first <p> child truncates or hides overflow as its container shrinks? I've tried using classes like whitespace-nowrap and overflow-hidden, but the text always wraps regardless. Any suggestions ...

Sending data from an HTML table hyperlink to a SQL query on a subsequent page

I am in need of assistance with passing a value from a database. I have successfully achieved this using drop-down boxes, selecting the option and then posting it with a submit button to populate tables in Display.php. However, my current task involves an ...

How to extract the value of inner HTML tags when submitting a form in a React component using HTML

Hello, I am currently working on retrieving the value of the nested HTML tag 'option' upon submitting the form. Essentially, I need to access the value of the option tag in the handleSubmit function when the form is submitted. Please note that th ...

Ajax TabContainer mysteriously vanishes during Postback

I'm currently working on a GIS web application using C# ASP.net. Within my project, I have an Ajax TabContainer that houses multiple TabPanels containing various elements like a map window and scale bar from the ESRI WebAdf toolkit. Below is a simpl ...

What is preventing the audio from playing in Safari?

Recently, I developed a small JavaScript program that is meant to play the Happy Birthday tune. This program utilizes setInterval to gradually increase a variable, and depending on its value, plays or pauses certain musical notes. However, I encountered ...

Display 4 images in a vertical layout without any padding, while ensuring responsiveness

Thank you to everyone for all the help! I have learned so much from your continuous support. I am working on creating a 4-way vertical "collage" of images with no spaces between each picture, that is fully responsive when resizing the window. However, I a ...

The SVG image does not display in browsers other than Internet Explorer (IE)

I am encountering an issue with adding a menu toggle image in SVG format to my HTML. Unfortunately, the image is not displaying as expected. Here are screenshots for comparison between Explorer and Chrome: https://i.stack.imgur.com/74sqh.png https://i. ...

Pattern of constructing PDO instances for connecting with a database

During my exploration of PHP with OOP, I stumbled upon discussions on Stackoverflow regarding the use of PDOs and avoiding globals and singletons. One particular question that caught my attention was titled How to properly set up a PDO connection, which p ...

What are the advantages of going the extra mile to ensure cross-browser compatibility?

It's fascinating how much effort is required to ensure web applications work seamlessly across all browsers. Despite global standards like those set by W3C, the development and testing process can be quite laborious. I'm curious why all browsers ...

What methods can be used to conceal a div when the content is not being shown?

I'm a beginner in HTML and CSS and I have a page with the following code: Content displayed : <div id="row-3" ><!-- Row 3 starts here --> <div class="groupz_column1" style="margin-right:0px;"><a href="http://www.xyz.in/ads/ ...

Is there a problem with the layout or indexing?

My website features a div that animates in using a jQuery click function, appearing over other divs that have animated in on $(document).ready(). Strangely, this div shows up behind the others only on the home page of my website and not on any other pages, ...

JavaScript function executes before receiving AJAX response

Within my code, there is an AJAX function named flagIt() that gets triggered by another function called validateForm() upon submission. The validateForm() function is responsible for form validation. function validateForm(){ var error = ""; //perf ...