Hi,
I have a hidden DIV, which is going to cover all of the screen as part of a lightbox. I wrote my code based on what I found at docs.jquery.com/Tutorials:Basic_Show_and_Hid . When I click on the link to run the lightbox, the div isn't showing even through the z-index is the highest on the page. I've also tried seeing if it was a corrupted version of jQuery. What's wrong?

<style type="text/css">
#video1
{
        position:absolute;
	top:350px;
        left:0px;
	width:100px;
	height:100px;
	background-color:#00FF00;
	z-index:4;
}
		
#lightbox
{
	position:absolute;
	top:0%;
	left:0%;
	height:100%;
	width:100%;
	background-color:#000000;
	opacity:0.7;
	visibility:hidden;
	z-index:5;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
 $(document).ready(function(){
				$("#video1").click(function(){
					$("#lightbox").show();
					alert("test");
				});
            });
        </script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Index</title>
   </head>
    <body>
<div id="video1"></div>
    </body>
</html>

jQuery's show function doesn't work with the visibility attribute. It works with the display attribute.

Change your JS code to say $("#lightbox").css("visibility", "visible") instead of $("#lightbox").show().

Hi,
thanks for the reply. The code works perfectly now, I needed to add a div tag for lightbox in the XHTML as well as the change needed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.