You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Expose issue in IE7 (z-index bug) Created Aug 7, 2009

This thread is solved

Views: 15179     Replies: 23     Last reply Dec 31, 2011  
You must login first before you can use this feature

joelataylor

Posts: 5

Registered:
Aug 7, 2009

Expose issue in IE7 (z-index bug)

Posted: Aug 7, 2009

Hi, has anyone else had an issue with the IE z-index bug with expose or overlay?

I have a div that is absolute positioned inside a relative positioned div. When I call my expose function it works fine in Safari and FF but not in IE - because if the z-index bug. To fix you need to add a higher z-index value to any of it's parents - but then this means the background image (or color) won't be over all the other content.

Hmmmm - I'm sure this has been solved though ... right?

joelataylor

Posts: 5

Registered:
Aug 7, 2009

» Expose issue in IE7 (z-index bug)

Posted: Aug 8, 2009

Reply to: Expose issue in IE7 (z-index bug), from joelataylor
No one got anything for me?

pkrasko

Posts: 14

Registered:
Jul 29, 2009

Expose Form, broken in IE

Posted: Aug 9, 2009

Reply to: » Expose issue in IE7 (z-index bug), from joelataylor
I'm currently trying to find a workaround.
Even the jQuery Tools demo is broken - if you try running the Expose Form demo in IE7 the form appears behind the overlay.

I don't have IE8 installed, but the z-index bug is supposedly fixed in it.

pkrasko

Posts: 14

Registered:
Jul 29, 2009

» Expose issue in IE7 (z-index bug)

Posted: Aug 10, 2009

Reply to: Expose issue in IE7 (z-index bug), from joelataylor
Ok I just had a few minutes to read about the IE z-index bug and ran a quick test.

Here is the deal:

If you have your expose mask with a z-index of 10, then the part you want exposed (and all parents!) must be higher than 10. In IE6/7 this means all the parent elements too, thus the IE z-index bug.



<div id="a">  <!-- this must be z-index 11 -->
   <div id="b"> <!-- this must be z-index 12 -->
      <form> <!-- this must be z-index 13 -->
         <p>Sample: <input type="text"/></p>
      </form>
   </div>
</div>

<div id="mask" style="z-index:10"></div>


I had an initial problem with this - the mask did no disappear when I click it, or focus out of the form. In this case we need to make sure div 'a' and div 'b' are the same width as the form. If the width is not specified then the div will cover the entire screen at a higher z-index than the mask. The only way to close the mask is to use the ESC key. In my case div 'a' and div 'b' are used with margin: 0 auto for positioning, and the width is fixed. I rather drop this effect than redesign the layout. I suppose I can probably have a javascript workaround for this issue, but it's not worth it for me.

joelataylor

Posts: 5

Registered:
Aug 7, 2009

» » Expose issue in IE7 (z-index bug)

Posted: Aug 10, 2009

Reply to: » Expose issue in IE7 (z-index bug), from pkrasko
Yeh - however when I set my z-indexes - the mask will display underneath the other div's with higher z-indexes (as I guess it should!). So - yeh. I still find it weird that there hasn't been any sort of fix for such a huge component of this toolset.

Weird.

pkrasko

Posts: 14

Registered:
Jul 29, 2009

» » » Expose issue in IE7 (z-index bug)

Posted: Aug 10, 2009

Reply to: » » Expose issue in IE7 (z-index bug), from joelataylor
Well the easy fix is to follow the steps I listed above. You just need to make sure that the parents have a width set to the object you want exposed. If not, the mask will display under the other divs.

I can't think of a fix for this due to the nature of the bug, besides what I mentioned above.

killebrewj

Posts: 83

Registered:
May 26, 2008

» » » » Expose issue in IE7 (z-index bug)

Posted: Aug 10, 2009

Reply to: » » » Expose issue in IE7 (z-index bug), from pkrasko
No promises, but this trick using jquery has always worked for me in bizzard z-index situations.

http://www.vancelucas.com/blog/fixing-ie7-z-index-issues-with-jquery/comment-page-1/

It has helped me with css drop down menus getting covered up by flash video as well as using expose on a div containing a flowplayer video. The issue in my case appears to be related to having the poisiton value of a div set to anything other than fixed.

pkrasko

Posts: 14

Registered:
Jul 29, 2009

» » » » » Expose issue in IE7 (z-index bug)

Posted: Aug 10, 2009

Reply to: » » » » Expose issue in IE7 (z-index bug), from killebrewj
That works in most cases.

I will further comment on my earlier which will explain why this won't fix it.


<div id="a" style="z-index: 1000">  <!-- ie fix, z-index 1000 --> 
   <div id="b" style="z-index: 990; margin: 0 auto; width:800px"> <!-- ie fix, z-index 990, with fixed with and centering --> 
      <form style="z-index: 500"> <!-- z-index 500 --> 
         <p>Sample: <input type="text"/></p> 
      </form> 
   </div> 
</div> 
 
<!-- z-index set to 499 so it appears below the form -->
<div id="mask" style="z-index:499"></div> 

The fix you mentioned will work 95% of the time. However in my case the z-index of the div 'a' is higher than the 'mask', clicking outside of the form will not deactivate the 'mask'. Essentially you are clicking on div 'a' and not the 'mask'.

Make sense?

joelataylor

Posts: 5

Registered:
Aug 7, 2009

» » » » Expose issue in IE7 (z-index bug)

Posted: Aug 10, 2009

Reply to: » » » Expose issue in IE7 (z-index bug), from pkrasko
Hmmm, nope your way won't work as the mask is UNDER the footer (or the containing element for the expose).

There's not even javascript trickery to get around this - that I can think of. Very frustrating.

gcornejo

Posts: 1

Registered:
Mar 5, 2010

How to avoid problem with IE7 zIndex problem

Posted: Mar 5, 2010

Reply to: Expose issue in IE7 (z-index bug), from joelataylor
The best way to avoid having this problem is easy, just make sure the overlay div parent is the body tag.
I just wasted 2 hours trying a CSS fix, but it's just a DOM and inheritance problem.
Hope to solve everyone's problem.

<body>
<div  class="apple_overlay" id="overlay">
	<!-- the external content is loaded inside this tag -->
	<div class="contentWrap"></div>
</div>
</body>

longe630

Posts: 1

Registered:
May 21, 2010

» How to avoid problem with IE7 zIndex problem

Posted: May 21, 2010

Reply to: How to avoid problem with IE7 zIndex problem, from gcornejo
Thank you. I rarely post on forums, I just read them, but I specifically signed up for an account on this site to thank you for the simplest solution to one of the most annoying problems.

bjacobs

Posts: 1

Registered:
Jul 28, 2010

» » How to avoid problem with IE7 zIndex problem

Posted: Aug 3, 2010

Reply to: » How to avoid problem with IE7 zIndex problem, from longe630
Adding this as an option to overlay works nicely

  onBeforeLoad:  function() {
          this.getOverlay().appendTo('body');
          }

This lets you place the original overlay element wherever you want.

TexasT1973

Posts: 3

Registered:
Sep 2, 2010

» » » How to avoid problem with IE7 zIndex problem

Posted: Sep 15, 2010

Reply to: » » How to avoid problem with IE7 zIndex problem, from bjacobs
This is a great solution. The only problem I found was that my form did not want to submit. In Firefox, it wasn't an issue...only IE. So instead of appending it to the body, I appended it to the 'form'. This solved the issue for me and anyone else who has a form with flowplayer overlay.

danbrendstrup

Posts: 2

Registered:
Jul 14, 2011

» » » How to avoid problem with IE7 zIndex problem

Posted: Jul 14, 2011

Reply to: » » How to avoid problem with IE7 zIndex problem, from bjacobs
The above solution didn't quite work for me, as my overlay no longer positioned itself correctly. However, the following worked, and solved the issue in IE7:

onLoad:  function() {
      this.getOverlay().insertAfter('#exposeMask');

kmaughan

Posts: 1

Registered:
Oct 28, 2011

» » » » How to avoid problem with IE7 zIndex problem

Posted: Oct 28, 2011

Reply to: » » » How to avoid problem with IE7 zIndex problem, from danbrendstrup
I love you danbrendstrup!

den_piero

Posts: 1

Registered:
Aug 4, 2010

position:static

Posted: Aug 4, 2010

Reply to: Expose issue in IE7 (z-index bug), from joelataylor
in my experience, you have to set ie7 css for the parent element you want to expose to position:static and the element you want to expose to relative. i hope it helps coz it's getting me days to get into this

Owidat
Mohammad Owidat ASP.NET Programmer webatme.com

Posts: 2

Registered:
Jan 6, 2011

I think it"s a z-index problem for IE

Posted: Jan 6, 2011

Reply to: Expose issue in IE7 (z-index bug), from joelataylor
I tried to make multiple elements exposed like:
$("img").expose();

It works fine for almost all browsers but IE do not expose all items, so I tried to make my own expose function that work for IE too like:

if ($.browser.msie && $.browser.version.substring(0,1) < '9')
{
    $('body').find('*').css({'z-index':1});
    $('<div />').addClass('lightbox_IE').css({'width':($(document).width()),'height':($(document).height()),'position':'absolute','z-index':50}).appendTo('body').show();
    $('.Result').each(function (i) {
        $(this).addClass("editeModeBox");
    });
    $('body').find('.Result').css({'z-index':60});
}
else
{
    $('<div />').addClass('lightbox_notIE').css({'width':($('body').width()),'height':($(document).height()),'position':'fixed'}).appendTo('body').show();
    $('.Result').each(function (i) {
        $(this).addClass("editeModeBox").css({'z-index':1000});
    });
}

my css is:

<style>

.editeModeBox
{
    position:relative;
    background-color: White !important;
    -webkit-box-shadow: 2px 2px 10px #4a4a4a;
    -moz-box-shadow: 2px 2px 10px #4a4a4a;
    box-shadow: 2px 2px 10px #4a4a4a;
    -moz-border-radius: 3px;
    border-radius: 3px;
}
.Result
{
    position:relative;
    padding:5px;
}
.lightbox_notIE
{
    background: #000 none repeat scroll 0 0;
    height: 100%;
    width: 100%;
    z-index: 999;
    left: 0;
    filter: alpha(opacity=50);
    opacity: 0.5;
    top: 0;
}
.lightbox_IE
{
    background: #000 none repeat scroll 0 0;
    /*background: url(../images/ui-bg.png) repeat;*/
    z-index: 999;
    left: 0;
    filter: alpha(opacity=50);
    opacity: 0.5;
    top: 0;
    display: none;
	bottom: auto;
	clear: both;
	top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop +(documentElement.clientHeight-this.clientHeight) - 1 : document.body.scrollTop +(document.body.clientHeight-this.clientHeight) - 1);
}
</style>

but I stuck with a problem again for z-index in IE, and I found that it is the same problem in expose class. then I tried to solve some z-Indexing problem with adding:


<!--[if IE 7]><script type="text/javascript">$(function(){var zIndexNumber=500;$('div').each(function(){$(this).css('zIndex',zIndexNumber);zIndexNumber-=5;});});</script><![endif]-->

but nothing worked.

if any one solve this problem please let us know.

plpepin

Posts: 1

Registered:
May 6, 2011

den_piero's discovery seems right on

Posted: May 6, 2011

Reply to: Expose issue in IE7 (z-index bug), from joelataylor
When I first ran into this problem, it occured to me that perhaps it would be more of a css support issue with IE7 since I could get the demo form to work. After a few hours of testing, I ran into the same conclusion as den_piero where I can have a succesfull expose occur with an image embeded inside a div tag that is still positioned natively (static) and as soon as I change the position of that same parent element to relative, it fails to work.

As per the z-layer solution, I haven't tested it but I always thought that layered elements could not overlay their parents, no?