Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
problem with z-index in gallery
Old 06-24-2008, 10:46 AM problem with z-index in gallery
Junior Talker

Posts: 1
Trades: 0
I was making a image gallery for a website, and wanted to have navigation similar to lightbox without actually using the lightbox javascript.

After a bunch of tinkering, I got it working in Firefox and Safari, but to my dismay it won't work in internet explorer 6,7 and opera.

The problem is that the nav, next, and prev divs are getting stuck behind the image in the gallery. You can see that they are because if you remove the image code from the page, the hover navigation works just fine over the black background.

Now obviously this appears to be a z-index issue, but I have spent hours meddling with different z-index values and changing the code but have gotten no where.

I have provided an example of the problem in a zip attachment. Only thing to note is that it is a very simplified version, as I have removed any extra code to make the problem easy to see. The blue.gif is a replacement for the image in the gallery, as any of the images in the gallery would have been too large to fit in the file cap for uploads.

I am at a loss as to how to fix this, I would be ecstatic if anyone could help me.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test</title>



 <style type="text/css" media="screen">
 
    #test {
    position:absolute;
    width:800px;
    height:640px;
    background-color: #000;

    }

    #nav{
    display: inline;
    width:100%;
    height:100%;
    }

    #Next,#Prev{
    position:absolute;
    width:50%;
    height:100%;
    outline:none;
    z-index: 999;
    }

    #Next{right:0;}

    #Prev{left:0;}

    #Next:hover{

    background:transparent url(next.gif) no-repeat 100% 30%;
    
    }

    #Prev:hover{

    background:transparent url(prev.gif) no-repeat 0% 30%;
    }

    #image{
    display:block; /* fixes ie6 display error */
    
    }


    
</style>

</head>


<body>

<div id="test">
 

  <div id="nav">

    <a href="#" id="Prev"></a>

    <a href="#" id="Next"></a>

  </div>

 <img id="image" src="blue.gif" alt="image" />

</div>




</body>
</html>
Attached Files
File Type: zip example.zip (3.2 KB, 2 views)
Derba is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-24-2008, 08:12 PM Re: problem with z-index in gallery
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
It's been awhile since I had this problem on a site, but I remember IE doing weird things sometimes with z-indexes. I think the z-index ends up being relative to the z-index of the containing div and not the body as you might expect.

Have you tried adding the z-index to #nav instead of #next and #prev? I'm not sure if that's your solution, but it's easy enough to try and see.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 06-25-2008, 10:33 AM Re: problem with z-index in gallery
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Here is a link I have saved, to remind me of the z-index issues in IE http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 06-25-2008, 09:32 PM Re: problem with z-index in gallery
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
That's the issue I was thinking of, though the link you posted does a better job explaining what's going on than I did.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to problem with z-index in gallery
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46057 seconds with 13 queries