Create a hover effect with an overlay on mouse hover

I'm struggling with achieving a specific effect.

Whenever I hover the mouse over this element :

<div class="process">
  <h3 class="text-center">Process</h3>
  <ul class="row text-center list-inline  wowload bounceInUp animated" style="visibility: visible; animation-name: bounceInUp;">
    <li data-id="Reflexion">
      <span><i class="fa fa-flask"></i><b>Reflexion</b></span>
    </li>
  </ul>
</div>

I wish to have an overlay covering the entire page, with my <ul>...</ul> on top of it

I've attempted using z-index and position, but unfortunately, it's not working as expected. The overlay always appears above all content, including the <ul>...</ul>

Below are the styles for <ul></ul> and .overlay

.process ul li{
    width: 10em;
    height: 10em;
    border: 1px solid #CEEBF0;
    padding: 0;
    border-radius: 50%;
    margin: 0 1.25em;
    line-height: 13.5em;
    color: #21ABCA;
     -webkit-transition: border-color 0.5s ease-in; /* Safari */
     -moz-transition: border-color 0.5s ease-in; /* Firefox */
    transition: border-color 0.5s ease-in;
}
.process ul li span{line-height: 2em;display: inline-block;font-weight: 300;}
.process ul li span i{font-size: 3em;}
.process ul li span b{display: block;font-size: 1em;font-weight: 300;}

.process ul li:hover {
    border-color:#3498db;
    background-color: rgba(52, 152, 219,1.0);
}

.overlay {
    position: fixed;
    z-index: 50;
    background-color: red;
    height: 100vh;
    width: 100vw;
}

Here is the script I'm using to listen to mouse events :

$(".process ul li").on({
    mouseenter : function() {
        $('#overlay').addClass('overlay');
    },
    mouseleave : function() {
        $('#overlay').removeClass('overlay');
    },
});

Update

There is a Fiddle that visually demonstrates my issue better than words can explain

Answer №1

When creating overlays, I typically utilize absolute positioning to ensure precise placement. Without specific details on the desired effect, here is a basic demonstration of how an overlay could function.

Check out this demo

By setting the overlay's position to absolute and configuring its positional attributes to 0, it covers the designated box entirely without the need to set explicit widths or heights.

I trust this explanation proves beneficial!

UPDATE

Although it seems you have already resolved the issue, I am providing a link to a fiddle showcasing a solution for future reference.

View the modified fiddle here

Answer №2

For the Z-index property to work effectively, both elements must be manually positioned. Ensure that the list is given a position: relative or position: absolute, not just the overlay. Additionally, make sure to assign a higher value to the z-index of the list.

EDIT: Consider adding this snippet to your code:

.process {
    position: relative;
    z-index: 100;
}

To achieve the desired effect where only the hovered panel appears in front of the overlay, you may need to experiment with the z-index values. This example underscores the importance of setting a position attribute for manual z-positioning.

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

Having difficulty transmitting an array using Jquery.post

My dilemma begins with an array of input values: <input type="text" placeholder="write your Question" id="question[]" value="" /> These inputs are then sent using the following code: $.post("function ...

What are the steps for integrating a date and time picker bootstrap plugin?

Referencing a tutorial from http://www.w3schools.com/bootstrap/bootstrap_modal.asp: <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> <div id="myModal" class="modal fade" role= ...

Ways to adjust the width of grid columns within an implicit row

I am curious about changing grid columns on an implicit row. While I won't provide the exact code that I'm working on, I will offer a brief example to clarify my question. <div class='container'> <p>item-1</p> <p& ...

When a div tag containing PHP is empty, it should either be hidden or show specific text based on your requirements

Among the plethora of unanswered queries regarding hiding empty divs, I find myself unable to make any of the suggested solutions work. Hence, I am putting forth my own question. On my webpage, there is a specific section dedicated to showcasing various it ...

Unable to assign changing content to iframe within fancybox on completion

Struggling to add dynamic content to a dynamically created iframe within the onComplete method of fancybox? The same issue arises with static iframes. Is there a way to update the content of an iframe during runtime? $(document).ready(function() { $(" ...

Uncovering the hidden gems within a data attribute

Trying my best to explain this clearly. What I have is a data-attribute that holds a large amount of data. In this case, I need to extract each individual basket product ID and display them as separate strings. The challenging part for me is locating thi ...

I would like to learn how to showcase a two-column array using PHP and HTML

In my current setup, I have a collection of icons that are displayed in groups of 4. This means that if there are 7 icons, the 4th icon on the first slide will be repeated as the 8th icon on the second slide. To resolve this issue, I am looking to iterate ...

What is the best way to adjust the sizes of two images within the same class to your liking?

My class called cbImage has a fixed CSS for all images. .cbImage img { width: 100%; height: 100%; } However, I don't want all images to have the same width and height. Is there a way to change the width and height of different images as need ...

Exploring the Power of Two jQuery Ajax Functions in Your Script

Is it possible to provide guidance on how I can successfully execute two separate Ajax calls within a single script without encountering conflicts? A sample of the current script structure is as follows: <script type="text/javascript"> $(document).r ...

Passing PHP array via AJAX call

I am uncertain if this specific inquiry has been addressed previously, so please alert me if it is a duplicate. The initial line contains a PHP merged array that I am attempting to transmit via AJAX to another page. I am facing challenges in figuring out ...

Utilize Express Node to display API information on HTML pages using Handlebars template

I'm seeking assistance in rendering data from an API to HTML using handlebars. I'm a bit puzzled on how to properly showcase the data on the webpage. Here's what I have so far: ROUTES FOLDER/FILE: const express = require('express&ap ...

What is the method for incorporating a currency symbol into a jQuery mask?

I have successfully implemented the mask on the <td> element of the table, but now I would like to include the currency symbol before the value as shown in the example below. if ($(this).attr('title')==='Value') { $(+ ...

Troubleshooting issues with sending data from Node.js to MongoDB

I recently started learning nodeJS and I'm facing an issue with sending data from a register form to mongodb. It seems like I made a mistake while using the post method, as I am unable to see the data on postman. const express = require('express& ...

PHP: Retrieving a selection value without the use of a submit button

I am trying to access and utilize the select value in my current PHP file, but without the use of a submit button. How can I accomplish this? Here is the code snippet I am working with: <?php $args = array( 'orderby' =&g ...

Tips for incorporating animated features into a bar graph using jQuery

How can I create a dynamic animated bar graph using jQuery? I am looking to make the bar slide up from the bottom, incorporating images for both the bar and background. I have already set the positioning in CSS and now need to add animation to make the bar ...

The Jodit editor is appearing incorrectly

Encountering an issue with the jodit wysiwyg editor or any similar plugin editor while working within a Bootstrap tab. When adding an editor to the tab content, the display is incorrect upon selecting the tab (displayed at a fraction of the height and miss ...

Activate continuous speech identification

Is it possible to activate the capability of recognizing continuous speech through the REST API (using javascript SDK) with the Bing Speech API? The Javascript SDK example available at https://github.com/Microsoft/Cognitive-Speech-STT-JavaScript only seem ...

Can you please point out the location of the error in the Java Script code

Our application is developed using Yii2 framework and incorporates Kartik's star-rating widget. However, there seems to be an error in the JavaScript code: Error message from console: Check out the problematic code snippet: <?php $js = ...

The screen reader is unable to interpret the text that is visible within the anchor tag

I have an Angular application with a dropdown menu implemented as shown below. When using the NVDA screen reader to navigate, only the content inside the aria-label attribute is being read when tab focused. However, I want it to also read the content (&ap ...

utilizing a spacemouse in conjunction with autodesk forge

Recently, I acquired a 3dconnexion spacemouse and have been attempting to configure it to work with the forge viewer. Fortunately, I came across some JS samples in the SDK for three.js that worked flawlessly. It seems both forge and three.js utilize webgl ...