difficulties experienced in changing the z-index property in Google Chrome

When transitioning to the main_page, z-index is not behaving correctly on Chrome but works fine on Firefox. Even after setting the z-index first and then applying the transition, there is a delay in how it acts. Any assistance would be greatly appreciated.

//flip function begins
window.$zindex=0;
$flip_left=function(e){

  //$('.zindex').removeClass("zindex");
  $this=$(this);
  $this.css({"z-index":window.$zindex});
  setTimeout(function(){
    $this.addClass("flip");
    $this.removeClass("flipin");
    $this.addClass("flip_right");

    window.$zindex+=1;
    if($('.main_page').hasClass("flip")){
      $('.main_row').css({"margin-left":"75px"});
    } else {
      $('.main_row').css({"margin-left":"0px"});
    }

 },100);

}


$flip_right=function(e){

  //$('.zindex').removeClass("zindex");
  $this=$(this);
  $this.css({"z-index":window.$zindex});
  setTimeout(function(){
    $this.removeClass("flip");
    $this.addClass("flipin");
    $this.removeClass("flip_right");

    window.$zindex+=1;

    if($('.main_page').hasClass("flip")){
      $('.main_row').css({"margin-left":"75px"});
    } else {
      $('.main_row').css({"margin-left":"0px"});
    }

  },100);


}

//all functions called here
$(document).ready(function() {

  $(document).on("click", ".flipin", $flip_left);
  $(document).on("click", ".flip_right", $flip_right);

});
.page_holder, body, .page p, div{
  margin:0;
  padding:0;
}

.wrapper_center{
  width:150px;
  margin:0 auto;
  margin-top:60px;

}

.row, .page, .main_page, .page_holder, .page p, .page img, .shadow{
  width:100%;
}

.row, .page, .main_page, .page_holder, .page p, .page img, .shadow{
  float:left;
}


.main_page, .main_row, .flip{
  transition:all 1.2s ease;
  -webkit-transition:all 1.2s ease;
}

.zindex{
  z-index:1000;
}


.page_holder{
  perspective:1800px;
  -webkit-perspective:1800px;
  -moz-perspective:1800px;
  height:200px;

}

.relative, .page_holder{
  position:relative;
}

.main_page{
  list-style:none;
  transform-style:preserve-3d;
  -webkit-transform-style:preserve-3d;
  -moz-transform-style:preserve-3d;
  transform-origin:left;
  -moz-transform-origin:left;
  transform:rotateY(0deg);
  -moz-transform:rotateY(0deg);
  height:200px;
  position:absolute;
  z-index:0;
}



.page{
  position:absolute;
  height:200px;
  -moz-backface-visibility:hidden;
  box-shadow:rgba(0,0,0,0.02) -3px 3px 5px;


}


.page p{
  color:#fff;
}

.side1{
  transform:rotateY(-180deg);
  -moz-transform:rotateY(-180deg);
  z-index:1

}

.flip{
  transform:rotateY(-180deg);
  -moz-transform:rotateY(-180deg);
  z-index:0;
}

.page1{background:#06F}
.page2{background:#F60}
.page3{background:#999}
.page4{background:#FF0}
.page5{background:#66C}
.page6{background:#000}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<body>
  <div class="wrapper_center">
    <div class="row main_row">
      <ul class="page_holder">

        <li class="main_page flipin">
          <div class="page page6 side1">
          </div><!--page ends-->

          <div class="page page5 side2">
          </div><!--page ends-->
        </li>

        <li class="main_page flipin">
          <div class="page page2 side1">
          </div><!--page ends-->

          <div class="page page1 side2">
          </div><!--page ends-->
        </li>

        <li class="main_page flipin">
          <div class="page page4 side1">
          </div><!--page ends-->

          <div class="page page3 side2">
          </div><!--page ends-->
        </li>

        <li class="main_page flipin">
          <div class="page page2 side1">
          </div><!--page ends-->

          <div class="page page1 side2">
          </div><!--page ends-->
        </li>

      </ul>

    </div><!--row ends-->

    <div class="ajax_json">
    </div><!--ajax_json ends-->
  </div><!--center wrapper ends-->
</body>

Answer №1

Your CSS transition property was set to all, causing it to try and transition the z-index as well. To resolve this issue, be more specific with the transitions you want by using code like:

.main_page, .main_row, .flip{
    transition:transform 1.2s ease, margin 1.2s ease;
    -webkit-transition:transform 1.2s ease, margin 1.2s ease;
}

This should help improve how the transitions behave. Check out the live example here: https://jsfiddle.net/gd51m3kn/1/

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

Set the class of an element dynamically using ng-class and detect changes with ng-change

I want the input field to initially have the class .form-control-error. When the user clicks on the field and starts typing, I would like it to change to .form-control-success. I attempted the following code but couldn't get it to update. The ng-chan ...

When hovering over slick text, it becomes hidden because of non-responsive CSS. Are there any solutions to make it responsive?

I can't seem to get the on-hover dates to appear, even though they are rendered when inspecting the page. I suspect it could be related to a responsive CSS issue or class breaking. How can I resolve this? https://i.stack.imgur.com/jyEJb.png https:// ...

Scrolling through image galleries with automatic thumbnails

I am looking to create an automatic image scrolling feature on my webpage using a bunch of images I have. I have searched for a solution but have not found one that fits my requirements. I don't think a carousel is the right approach for this. The sol ...

Need inspiration for testing web content with Protractor?

Exploring new possibilities for testing web content with Protractor. Any fresh ideas on what else can be tested? So far, I've checked links to ensure they redirect correctly. I've also verified text color and decoration changes when hovering ove ...

Unable to retrieve the name value of the option_id in jQuery due to an

<script type="text/javascript> $(document).ready(function(){ $('#btnSubmit').bind('click', function(){ $('.hiddenId').each(function(){ var id = $(this).val(); var option = $('#option_&apos ...

Concentrate on the disappeared div element following the AJAX request

Encountering an unusual issue here that has me a bit puzzled. In one of my DIV elements, I have included several links which trigger an AJAX call (using jQuery) upon being clicked. The server (Controller) then responds with HTML content, specifically a JS ...

Sending an Ajax request to a nearby address

I'm feeling a bit lost on how to achieve this task. I've been searching online, but it seems like my search terms may not have been quite right. My goal is to set up a RESTful api. $.ajax({ type: "POST", url: "https//my.url/", data: ...

Struggling with a dynamic HTML table using Mustache and Icanhazjs technologies

I am encountering an issue while attempting to construct a dynamic table using Icanhazjs (Mustache). The table data is consistently rendered outside the table tag, resulting in my data not being displayed within the table itself. To observe the output, pl ...

Display the original content of a previous div element after modifying it using JavaScript

I wanted to simplify the code. In my jsp file, when the document is loaded, the select values are filled in automatically. For instance: <div class="col-sm"> <label style="font-size: 20px;"><fmt:message key="cap.workplace"/>: </ ...

Barba.jS is causing a delay in loading scripts after the page transition

One of my index files includes Gsap and Barba JS, while an inner page includes additional JS files such as locomotive.js and OWLcarousel.js. These two JS files are not necessary for the index page. However, when transitioning from the index page to the inn ...

Creating smooth transitions using JQuery's fade in and fade out effects

Within the webform, there are 3 divs and an img tag. Each time a div is clicked, the image within it should fade out, and a new picture should fade in. Here's an example: <script> $(document).ready(function () { $("#d2").click(func ...

Modify picture properties when listbox is altered using jQuery

I need to set up a unique album gallery display where different folders are selected based on the item chosen in a selectbox. Below is the HTML code: <select name="album" id="album" onChange="changeimage();"> <option value="0" selected disab ...

Troubleshooting issues with my Bootstrap 4 responsive column layout

I recently created a basic responsive website layout with Bootstrap 4. It should display 4 columns when in tablet mode, which is when the viewport is 768px wide. However, my layout works fine up to 770px, showing 4 columns. But as soon as it hits 769px, it ...

Verify whether the combobox has been chosen

Currently, I am dealing with two comboboxes and need to determine which one is selected. My intention is to achieve this using ajax and jquery within a JSP file. if(combobox1 is selected) { perform action 1 } if(combobox2 is selected) { perform actio ...

In Internet Explorer 7, a newline within a <pre> tag may cause display issues

Within my ASP.NET MVC 3 project, I am working with the following code: <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" ty ...

TroubControls not functioning properly in ThreeJS when using import map

Looking for assistance in setting up a simple ThreeJs with OrbitControls for pan and zoom. I successfully got it working with an older version (128), but encountering issues with the newer r168. In my example, I am attempting to directly embed the JavaScr ...

The functionality of AJAX is triggered only on the second click

On my index.html page, I'm attempting to implement a basic AJAX functionality. When clicking on an anchor tag, the text will be sent to a PHP page called data.php, which will then display the clicked page. The code is functional, but there seems to be ...

Show JSON array items

My php file (history.php) generates a JSON object $i=1; $q=mysql_query("select * from participants where phone='".mysql_real_escape_string($_GET['phone'])."' limit 10"); while($rs=mysql_fetch_array($q)){ $response[$i] = $rs[&ap ...

Hiding scrollbars in a component: The ultimate guide

I am seeking a way to completely hide scrollbars from an HTML component using CSS styles within a VueJS component. I have tried the solution of using overflow-y: hidden; within the component as well as within a specific subclass in the CSS, but neither com ...

display the JSON response using jQuery

Having an issue with printing the response JSON using a message alert. Here is the script I am using: $.ajax({ headers: { "Accept" : "application/json", "Content-Type": "application/json" }, url: "http:/ ...