Div element failing to respond to hover effect

I have implemented a hover effect to display an icon overlay and filter on the Instagram feed of a website I am currently working on. Everything looks perfect when I inspect the element and set the state to hover. However, when I test the website and hover over the images, the hover effect does not show up.

Why is the hover state not being acknowledged?

#insta-feed>a>img,
.ig__overlay--container {
  width: 25vw !important;
  height: 25vw !important;
}

.ig__overlay--container {
  left: 0px;
  background-color: rgba(0, 0, 0, 0);
  background-size: 25px 25px;
  background-position: center center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 300;
}

.overlay__container {
  position: absolute;
  pointer-events: none;
  z-index: 300;
}

#insta-feed>.overlay__container>div.ig__overlay--container:hover {
  background-color: rgba(0, 0, 0, 0.3);
  background-image: url({{ 'icon-socialig-menu.svg' | asset_url }} );
}
<div class="social__container">
  <div id="insta-feed" style="text-align: center;">
    <div class="flex flex-row overlay__container">
      <div class="ig__overlay--container">
      </div>
      <div class="ig__overlay--container">
      </div>
      <div class="ig__overlay--container">
      </div>
      <div class="ig__overlay--container">
      </div>
    </div
</div>

Answer №1

It's possible that my understanding is flawed, but it seems like the pointer-events property, which is set to inherit by default, is causing the child element div.ig__overlay to take on the value of pointer-events: none from its parent. This could be why you are able to manually change the state even though mouse events are not normally detected.

reference: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events?v=different_example

"The element itself does not respond to mouse events; however, if its descendants have different values for pointer-events, then mouse events can target those specific descendants. In such cases, event listeners on the parent element will still be triggered during the event capture and bubble phases as necessary."

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

Troubleshooting the Ineffectiveness of the CSS Custom Property Url in Asp .Net

Working on styling some cards within an MVC project, I have a custom property in my CSS file called "--bg-img" which is defined as follows: background-image: linear-gradient(rgba(0, 0, 0, var(--bg-filter-opacity)), rgba(0, 0, 0, var(--bg-filter-opacity))) ...

Angular 2's innovative approach to implementing a sticky footer concept

Is there a way to make my footer sticky without being fixed? I attempted using the CSS negative margin trick, but it did not work as expected. In the provided Plunker code, I tried to replicate the issue in my Angular 2 app. The goal is for the footer to s ...

Creating a Timeout Function for Mobile Browsers in JavaScript/PHP

Currently, I am developing a mobile-based web application that heavily relies on AJAX and Javascript. The process involves users logging in through a login page, sending the data via post to the main page where it undergoes a mySQL query for validation. If ...

Animating CSS when closing a modal box

I followed the instructions from a tutorial on W3Schools here to create this code. The "open model" button triggers the modal to open with a smooth CSS animation, which looks great. However, when I click the close button, the modal abruptly closes without ...

How to retrieve the value from an editable td within a table using Jquery

I am working with a dynamic table that looks like this: <table> <tbody> <tr> <td>1</td> <td contenteditable='true'>Value1</td> </tr> <tr> ...

What is the correct way to align these two blocks side by side?

I have an image (https://i.stack.imgur.com/v71LR.png) and I'm trying to achieve a similar layout. Currently, my approach involves using two divs - one for the left column (containing the image) and one for the right column (with heading and paragraph ...

Using jQuery to dynamically include option groups and options in a select box

Generate option groups and options dynamically using data retrieved via AJAX. <select name="catsndogs"> <optgroup label="Cats"> <option>Tiger</option> <option>Leopard</option> <option>Ly ...

Having trouble sending the selected value from a dropdown list to the server using $.ajax

I am embarking on my first project using JQuery (jquery-3.0.0.min.js) and JavaScript. My goal is to build a straightforward web form that connects to a database through a Web API. The form consists of various input text fields and two select dropdowns. ...

Attempting to place numerous recurrent elements in a fixed position relative to the perspective of the observer

Describing the appearance of my button <a href="website" class="button">Link 1</a> Now, I need to place another set of 4 similar buttons in a horizontal row next to it. <a href="website" class="button">Link 2</a> <a href="webs ...

Obtaining the name of the image that has been uploaded using jQuery

//Image upload function $(function() { $(":file").change(function() { if (this.files && this.files[0]) { var reader = new FileReader(); reader.onload = imageIsLoaded; reader.readAsDataURL(this.files[0]); } }); }); function im ...

Using Jquery to input selected dropdown values into a text input field

Currently, I am facing some challenges in achieving this task. My goal is to have the selected option from a dropdown list called programs_dropdown added to a text field named programs_input, with the option values separated by commas. For example: php, j ...

How do I adjust the ul size to be proportionate to the header?

I have a list with corresponding hyperlinks in my code, and I am trying to make these elements the same size as the header. I attempted adding auto padding and height auto but it did not produce the desired result. Here is the HTML snippet: <header id ...

Tips for embedding an object into an iframe source

I have successfully integrated a YouTube iframe into my HTML file. However, I would like the source URL to be dynamically generated based on data from the backend rather than manually inputting the URL as shown below. In the admin panel, there is an object ...

Is it possible to integrate external search functionality with Vuetify's data table component

I am currently working with the v-data-table component from Vuetify, which comes with a default filter bar in its properties. This table retrieves data from a local JSON file. The issue arises when I have another external component, a search bar created u ...

I am attempting to display the Δ symbol on my website, however, it is not appearing on the webpage

In my attempt to display my company logo on the website, I encountered an issue where the Δ symbol is not appearing correctly in the browser. strong class="footer-logo">KyΔnsys</strong To address this problem, I have implemented unicode charset=" ...

Modifying the content of a webpage with the help of Tampermonkey

I'm working on changing a W Text into B using the code below. It's functional, but I'm experiencing two issues. First, there is a lag when refreshing the page where it briefly shows the W text before replacing it with a B. Second, every 20 o ...

What methods does the W3C CSS Validator use to recognize a CSS3 document?

Help Needed! Can someone tell me how to specify a CSS3 file for validation by the W3C? In HTML5, we use <!DOCTYPE html>, but what should we use in a CSS file? Whenever I try to validate my CSS file containing CSS3 elements like @font-face and box- ...

Why isn't the ajax table showing up in my HTML?

I am facing an issue while trying to run an application that involves AngularJS, Ajax, and a Java Controller returning JSON. Despite my efforts, the table is not displaying in the HTML. I am new to working with Ajax and AngularJS, and need assistance troub ...

Problems with aligning elements to both the left and right sides of the same line

Currently, I have two divs that I would like to float on the left and right sides. However, they seem to be sticking together and I can't seem to separate them.. HTML: <nav> <div id="nav_content"> <div id="home_ico ...

The right-floating div element is not displaying horizontally; instead, it is breaking into a new line

My issue is the dynamically added div elements are not displaying horizontally within a container div element with a specific width. They always break into a new line. Below is the code snippet I am using: var i=1; $(document).ready(function () { ...