Is your overlaying div functioning properly in Chrome and Firefox, but encountering issues in Internet Explorer?

I am facing a challenge with overlaying two divs on top of an image. My objective is to create a simple lightbox where when the user hovers over the left or right side, the cursor changes to a pointer and arrows appear. Below is the code I am using:

HTML:

<div class="container">
    <img src="http://dummyimage.com/600x600/000/fff.jpg">
    <div class="left">
    </div>
    <div class="right">
    </div>
</div>

CSS:

.container {
        position: fixed;
        top: 50%;
        left: 50%;
        width: 600px;
        height: 600px;
        margin-top: -300px;
        margin-left: -300px;
        background-color: lightgrey;
        z-index: 10000;
}

.left {
        position: absolute;
        top: 0;
        left: 0;
        width: 100px;
        height: 100%;
        cursor: pointer;
        z-index: 10500;
}

.left:hover {
        background: rgba(248, 248, 248, 0) left center no-repeat url("http://imageshack.com/a/img823/9885/bsux.png");
}

.right {
        position: absolute;
        top: 0;
        right: 0;
        width: 100px;
        height: 100%;
        cursor: pointer;
        z-index: 10500;
}

.right:hover {
        background: rgba(248, 248, 248, 0) right center no-repeat url("http://imageshack.com/a/img845/5814/75r3.png");
}

JSFIDDLE: Fiddle

While this setup works smoothly in Chrome and Firefox, it seems to be causing issues in Internet Explorer. Interestingly, if the image is removed, the functionality works fine. What could be causing this problem and how can I resolve it?

Answer №1

It seems like there may be an outdated IE bug causing this issue. If the .left element does not have a background-color set, it might not recognize the .left:hover condition. Adding a transparent default color to .left could potentially solve the problem.

background-color: rgba(248, 248, 248, 0);

UPDATE: Here is a working example in this fiddle, http://jsfiddle.net/fEy9a/9/

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

What is the most effective method for creating a gallery of images on a website?

I am looking to create a website that primarily features images. This site is intended to visually showcase our products, allowing visitors to explore each part of our offerings on their own. Can anyone recommend a specific jQuery program I can use to ach ...

Tips for designing a horseshoe-inspired meter using CSS

  I want to create a horseshoe-shaped gauge using CSS that resembles the image below:     My attempt involved creating a circle and cutting off the bottom, similar to the technique demonstrated in this fiddle: http://jsfiddle.net/Fz3Ln/12/   Here& ...

Utilize jQuery to selectively truncate a list and toggle the visibility of random list elements within a specified maximum limit

Looking to showcase only 6 out of the over 6 list elements within a <ul>, but in a random and staggered manner. Consider the following initial structure: <ul> <li>1<li> <li>2<li> <li>3<li> & ...

Retrieve the parent's current state by accessing it through a callback function in React

My callback function onRestore is only logging the history until the id of the clicked snapshot. Why is it showing incorrect state? I've exhausted all options, so any help would be appreciated. import React, { useState, useEffect, useRef } from "re ...

Adjust the width of the table by utilizing the border-collapse property set to collapse

I am completely baffled by this situation. Whenever I adjust the border-width of a table (either dynamically with JavaScript or in Chrome Dev Tools) where border-collapse: collapse; is set, transitioning from a border width of 1px (#1) to a larger value (# ...

Managing multiple element click events through bubbling

I have a collection of controls contained within a main div called overlay-controls. Each control has its own set of overlay-controls. To handle deletion, I am using a for loop to attach an event listener to each button with the class delete. Prior to a ...

Tips for capturing and storing video with HTML5 WebRTC

Before reading the description, make sure to run the code snippet first. This will provide you with a better understanding of the structure. In the 2nd video element, I am trying to record, play, and save video. The issue I'm encountering is that the ...

The mobile view of the homepage slider is not appearing correctly

.main-slider-img > img{ width: 100%; } .main-slider-content { left: 15%; margin-top: -146px; position: absolute; top: 50%; } .main-slider-content > h2{ line-height: 50px; padding ...

Adding an image to your email content using Django

I tried using Django's Email message module to send an email with an embedded image. The image is located in my static folder. I attempted to use HTML code within Python to trigger the email, but the image is not appearing in the email. I have tried s ...

AngularJS: intercepting custom 404 errors - handling responses containing URLs

Within my application, I have implemented an interceptor to handle any HTTP response errors. Here is a snippet of how it looks: var response = function(response) { if(response.config.url.indexOf('?page=') > -1) { skipException = true; ...

How can I display a nested div when the parent div's v-if condition is not met?

In my project, I am utilizing Laravel 6 in combination with Vue.js 2. To iterate through users and showcase their information within div elements, I am using a for loop outlined below. The Category names are stored in user.pivot.demo2, and the users are ...

The DataList is not displayed within the input field on the HTML page

I'm experiencing an issue with the DataList element in HTML. When I center the entire site, the dropdown menu in the input field doesn't display. For example: <!DOCTYPE html> <html lang="en"> <head> <meta chars ...

It is not possible to alter the styles of the ng-daterangepicker Angular plugin

After installing the angular2 plugin "ng-daterangepicker", I attempted to resize a div within it by modifying the .sass file. However, despite clearing the cache, the changes did not reflect in my browser. It seems that I may need to make adjustments to .s ...

My website layout got messed up because of Chrome version 48

Once upon a time, I created a website. Despite its outdated design, it has been functioning properly. Even though I know it's time for something new, I've hesitated to make any changes because it still works. Surprisingly, parts of the page layo ...

Slideshow through each item using Typescript and Angular8

I came across a solution in this carousel on by one link, but I'm struggling to work with the jQuery code even though I have JQuery installed in my project. For example: const next = jQuery(this).next(); I am looking to convert the JQuery code from ...

Loading a different webpage seamlessly without having to reload the current one

Here is a snippet of my code in okay.html: {% extends "sch/base.html" %} {% load staticfiles %} {% block content %} <div class="row" id="ada"> <form action="" method="post> {% csrf_token %} <div align="center" class="cont ...

Looking to perform an Ajax call to update a Rails model using HTML5 contenteditable, but encountering an issue where it creates a new

I am in need of assistance to update the plots of a story using HTML5 contenteditable feature. Below is the code snippet: Refer to file# for editing multiple plots <div id="editable" contenteditable="true"> <%= simple_format p.description %&g ...

What advantages do CSS pre-processors (SASS, SCSS, LESS) bring to the table for creating Responsive Web Designs?

Currently, I am embarking on a Responsive Web Design (RWD) project and contemplating whether integrating LESS would streamline the process. Are there practical benefits to utilizing CSS preprocessors for RWD projects? I suspect that employing media qu ...

The style from '<URL>' was not applied as it has a MIME type of 'text/html', which is not a compatible stylesheet MIME type

After attempting to run the angular application with the home component, an error appeared stating that styles were refused and images could not be found. It's puzzling because the CSS and image folder are located in the /src/assets folder. I have tr ...

What is the best way to create a drop-down menu that exports data directly to an Excel spreadsheet?

I have been struggling with a seemingly simple issue - I can't seem to get my drop-down box to display the chosen option. The code I'm using is quite similar to this generic one, but for some reason, it's not reporting the selected option to ...