Tips for ensuring z-index cooperation with the jQuery plugin Cycle

Have you had a chance to check out the bottom right example on the jQuery Cycle Advanced Demos page? If so, you might have noticed that when the gallery loops, the next image goes underneath the last one instead of covering it up. This seems to be the case in Firefox 3.6.3.

I am currently working on a custom animation using jQuery cycle and I'm facing a similar issue. When the gallery loops, the next image is displayed beneath the previous one instead of on top of it.

Here is the configuration object I am passing to cycle():

{
  fx: 'custom',
  timeout: 5000,
  easing: 'easeInOutQuad',
  pause: 1,
  cssFirst: {
       zIndex: 0
  },
  cssBefore: {
       display: 'block',
       top: -500,
       opacity: 1,
       zIndex: 1
  },
  animIn: {
       top: 0,    
       opacity: 1
  },
  animOut: {
       opacity: .2    
  },
  cssAfter: {
       display: 'none',
       opacity: .2,
       zIndex: 0
  },
  delay: -1000

}

Essentially, my animation functions similarly to the cover effect, with the only difference being that the previous image should fade away as the new one comes down on top of it.

Is there a possible way to make the next slide cover the previous one when looping?

Thank you for any assistance!

Answer №1

My approach may be considered a bit unconventional, but it gets the job done...

$headerImage.find('#gallery ul').cycle({
            fx: 'custom',
            timeout: 5000,
            easing: 'easeInOutQuad',
            pause: 1,
            cssFirst: {
                 zIndex: 1
            },
            cssBefore: {
                 display: 'block',
                 top: -400,
                 left: 0,
                 opacity: 1,
                 zIndex: 1
            },
            animIn: {
                 top: 0,    
                 opacity: 1
            },
            animOut: {
                 opacity: .2    
            },
            cssAfter: {
                 display: 'none',
                 opacity: .2,
                 zIndex: 0
            },
            delay: -1000,
            after: function(current, next) {

             // There were some issues during looping where the new image wasn't covering the previous one. I came up with this workaround to solve that.
         if (next == $headerImage.find('li:last')[0]) {
             $headerImage.find('li:last').css({ zIndex: -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

Element statement is not responding correctly on hover when combined with an if statement

Desperately seeking some JQuery assistance here. I feel like tossing my laptop out the window. After countless hours of coding, I've hit a roadblock that's driving me crazy. I'll only share the relevant portions of the code since it's ...

I am interested in monitoring for any alterations to the @input Object

I've been attempting to detect any changes on the 'draft' Object within the parent component, however ngOnChange() does not seem to be triggering. I have included my code below, but it doesn't even reach the debugger: @Input() draft: ...

I am looking for string validation in Angular

Hello, I have just one input box where I enter a 10-digit string, and I am looking to apply the following validations to the entered string: The first 4 characters should be alphabets The characters from 5 to 9 should be numeric The last character should ...

Quarterly Date Selection Tool with jQuery

I attempted to utilize the Quarter datepicker from: http://jsfiddle.net/4mwk0d5L/1/ Every time I execute the code, I encounter this problem: Cannot set property 'qtrs' of undefined. I copied exactly what was in the jsfiddle, and included the sam ...

Issue with MUI Grid item not functioning properly when using overflowY: "auto"

I am encountering an issue while using MUI with React. I have a <Paper> element wrapping a <Grid> with 3 children elements. The problem arises when I set the overflowY property of the bottom grid item to "auto" - instead of showing the scroll b ...

Dealing with a missing response in an Ajax Server-Side Call: The .done(function(data){..} function remains inactive

Let's say I make an Ajax server-side call using jQuery like this: $.ajax({ url: "/myapp/fetchUser?username=" + username, type : "get", dataType : "json", data : '' }).done(function(data) { co ...

Refreshing the Date Display with AJAX Response

Within a view, there is a DisplayFor connected to a DateTime field in the Model. After an AJAX call returns a Date to update the field, I am able to convert the AJAX date into a MM/DD/YYYY format. However, using .val to set the DisplayFor does not reflect ...

Issues encountered while modifying Vue data

In my Vue JS 2 code, I have structured my data as follows: data : { newBus: { name: '', hours: { sunday: '', } } } When setting the data usi ...

Calculate the percentage of the original height in relation to the document height

Is there a way to adjust the height of the document after new elements are added, without leaving excess space? I'm currently using the following code: $(document).ready(function() { var document_height = $(document).height(); document_height ...

directive still running despite attempting to stop the service

In my modal window, there is a directive that utilizes a service to make HTTP requests at regular intervals using $interval. However, even after closing the modal window, the service continues to run and make requests every 30 seconds. Is there a way to ...

Simple method for integrating alert pop-ups on every page of current Asp.Net MVC (RazorView) application

Our current ASP.NET MVC 4 application utilizes RazorView for its structure. We now have a need to display information messages as pop-ups on each page. This information may come from an ajax call to a metadata service, or after a form submission operation ...

Apply SetTimeout exclusively for desktop devices

A website I'm working on has a background video from YouTube using YTPlayer. To enhance the user experience, I have implemented a CSS spinner that displays while the page is loading. However, I noticed that the spinner disappears before the video fini ...

In AngularJS, the decimal point is represented by a comma

Several countries use the point as a comma for numbers, and the comma as a decimal separator. This includes Europe (excluding UK and Ireland), South America, Russia, and French West Africa. Find more information on Wikipedia How can we determine if a user ...

Translate Latitude and Longitude values into X and Y coordinates on an Albers projection map

Trying to plot a point on a map with Albers projection using the given latitude and longitude coordinates, but encountering issues. The map is built with the Albers projection using standard parallels at 52 and 64 degrees with WGS 84. I attempted to imple ...

Strategies for Delays in Receiving Callback Results in JavaScript

I've been working on a code that can read PDF files and convert them into CSV format. The code is functional for reading one file at a time, but now I'm attempting to expand it to handle multiple files simultaneously. Here's how the code wor ...

Unable to bring in openai on Node.js

I recently installed Node version 16.13.1 and globally installed the openai package using 'npm install -g openai'. In my script, I imported the necessary packages like this: const { Configuration, OpenAIApi } = require('openai') Howeve ...

A guide on keeping the table header fixed when incorporating a navbar in Bootstrap 4

I am attempting to create a navigation bar along with a large, scrollable table that can scroll both horizontally and vertically. Despite reviewing other solutions on Stack Overflow, I am struggling to implement the same on my own website. There seems to ...

Calculating the total price of items in a shopping cart by multiplying them with the quantity in Vue.js

I am currently working on enhancing the cart system in Vue.js, with a focus on displaying the total sum of product prices calculated by multiplying the price with the quantity. In my previous experience working with PHP, I achieved this calculation using ...

Utilizing AJAX with a REST API Independently of Server-Side Frameworks

I have developed a REST based API (Read only) to access the services of my application. My plan is to create a web application that will utilize these APIs to display basic information about the application's status. I intend to use AJAX with jQuery t ...

Tips on incorporating "get_template_directory_uri" into a JavaScript function

I am currently working on my WordPress PHP file code, where I have included a JavaScript snippet to display names and images from a query. While the names are being displayed correctly, I am encountering an issue with the images not showing up. After tryi ...