Place an element in a higher position than a slideshow

I recently encountered an issue where I was trying to place a png image above my slideshow. Despite trying various solutions, the image always appeared behind or on top without transparency.

Based on the erratic display, it seems like the problem might be related to the Z-index, but I'm struggling to pinpoint the exact cause of the issue.

Here is the code snippet: http://jsfiddle.net/6fSAt/6/

<div class="container">
    <img  class"cache" src="http://imageshack.com/a/img822/4694/1gqc.png"/>    

    <div class="cachecontainer">
        <div id="Fader" class="fader">
          <img class="slide" src="http://www.barrelny.com/wp-content/uploads/about-office-slide-pingpong2-800x500.jpg"/>
          <img class="slide" src="http://www.barrelny.com/wp-content/uploads/about-office-slide-bookcase-800x500.jpg"/>
          <img class="slide" src="http://www.barrelny.com/wp-content/uploads/about-office-slide-bikerack-800x500.jpg"/>
        </div>
    </div>  
</div>

body {
width: 100%;
height: 100%;    
}

.cache {
position:absolute;
width:504px;
height:781px;
margin:auto;    
z-index:998;
}

.container {
position:relative;
overflow:hidden;
width:504px;
height:781px;
margin:auto;
background:#FF00FF;
}

.cachecontainer {
position:absolute;
}

.fader{
padding-top: 60%;
} 

.fader .slide{
position: absolute;
width: 100%;
height: 100%;
top: 0;
z-index: 1;
opacity: 0;
}

.fader img.slide{
height: auto;
}

Answer №1

To ensure an image appears on top, apply position: absolute; and set the z-index property.

div.container img {
    position: absolute;
    z-index: 100;
}

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

Passing data from PHP to jQuery in a file upload script

I'm facing a problem that I can't seem to solve on my own. What I am trying to achieve is to upload a file to the server via PHP (upload.php), generate a new filename, and then pass that new filename to my webpage (upload.html). Within my uploa ...

Error: Attempting to create a 'guid' property on the 'option:selected' string is not possible and results in a TypeError

Encountering an error when trying to implement cascading drop down functionality using Ajax. Can someone provide assistance? <script type="text/javascript"> $("#os").change(function () { debugger var osid = $(this).select("opt ...

Transfer the imageURI to a different HTML page

My mobile app, created using PhoneGap, allows users to select an image from their album. I want to pass that selected image and display it on another HTML page. Does anyone have any suggestions on how to achieve this? Below is the code snippet: selectImag ...

Pattern for Ajax callback in Javascript

I'm facing an issue with the code snippet below. var bar = { ajaxcall : function(){ var _obj = {}; $.ajax({ headers: { 'Content-Type': "application/json; charset=utf-8", 'da ...

Merge the movements of sliding a block along with the cursor and refreshing a sprite displayed on the block

Confronted with the challenge of combining 2 animations, one to move the block behind the cursor inside the container and the other to update the sprite on the block. Let me elaborate further on my issue. The block should only move when the cursor is insi ...

Strange circle border appearance in Android / Chrome device

Having an issue with my code on a Samsung Galaxy S5 in Chrome 54.0.2840.85, Android 6.01. You can view the problematic codepen here: http://codepen.io/johnsonjpj/pen/jVpreB The border displays correctly on Firefox and iPhones, but not on my device. Trou ...

Using CSS grid can allow for paragraphs to overlap on top of each

Currently working on constructing a biography page filled with text content, and I aim to utilize CSS GRID instead of floats. I encountered an issue in getting the text to occupy all the available white space within the layout. I have attached an image to ...

Having trouble adjusting the height of <a> elements in the navbar

My navbar has an issue where the listed items do not fill the entire height of the navbar. I have tried adjusting padding and margin, but it doesn't seem to be affecting the layout. Any suggestions would be greatly appreciated. Thank you. #navbar { ...

Troubleshooting image overlay alignment concerns

My script successfully adds the image src to the overlay's image, but I encounter a problem when creating the variable imgH for the margin-top value. It calculates the image's height and divides it in half. The issue arises when the calculated h ...

Troublesome php ajax application failing to function

Despite creating a simple PHP and AJAX application, I am encountering issues and unable to identify the root cause. Below is my code snippet: <?php $grId = $_GET["groupId"]; $limit = $_GET["limit"]; if ($limit <= 0) { $limit = 10; } $serverna ...

Store the link in a variable and retrieve its content into another variable

Is there a way to extract the content of a link stored in a variable and store it in another variable using jQuery or javascript while working on an XML page? I know this is possible with php, but since I am developing a Chrome extension, I am wondering ...

"Using jQuery's POST method to send requests and Django's

I am currently using jquery post method for pagination. When django receives the post request, it sends back a response. However, I am facing an issue where I am unable to see the response displayed in the browser. This is the JavaScript code snippet tha ...

The image code is not recognizing the image source

In my attempt to dynamically set the image source in an HTML element after creating it with JavaScript, I have made some interesting observations through testing and alert messages: When providing the image src as a fixed filepath during the creation o ...

The onClick event in HostListener is intermittent in its functionality

While attempting to create a dropdown box in Angular by following these examples, I am encountering inconsistent results. Below is the code I have used: HTML <button (click)="eqLocationDrop()" id="eqLocButton"><i class="fas fa-caret-down">< ...

When working with angular.js and angular-sanitize.js, the src attribute is removed from JSON HTML data

I'm new to Angular and I'm really enjoying learning how to work with it. Currently, I have a simple JSON file that contains text structured like this: "gettingstarted":{ "title":"Getting Started", "content":"<img ng-src='i ...

Utilizing JQuery for cascading dropdown features in C# MVC

I am currently working on implementing Cascading dropdown lists in C# MVC using jquery. I am fetching data from the Database to populate the drop-downs. However, I am facing an issue where the drop-down does not populate based on the selection made in the ...

Encountering a 404 error while trying to delete using jQuery

I have been attempting to execute a 'DELETE' call on an API, but so far I have had no success. Despite being able to access the URI and view the JSON data, my DELETE request does not work. Interestingly, other web services are able to perform thi ...

Modifying the HTML <select> element with JavaScript

[resolved] I'm encountering an issue with the code below that is supposed to dynamically change the options in a second drop-down menu based on the selection made in the first menu. I've tried to troubleshoot the problem but haven't been suc ...

applying the "active" class to both the parent and child elements

Looking for a way to apply an active class to both the parent and child elements when a user clicks on the child element within a list. The HTML structure is as shown below:- <ul class="tabs"> <li class="accordion"><a href="#tab1"> ...

Transforming jQuery into vanilla JavaScript in order to create a customized dropdown select functionality

I am struggling with converting jQuery code to pure JavaScript for a custom select element. https://codepen.io/PeterGeller/pen/wksIF After referencing the CodePen example, I attempted to implement it with 3 select elements. const select = document.get ...