DS928
asked on
Div Without Picture
I have a div that opens when you click on a photo. However I want a Div to open without a photo, just a white box. What would I change to do this?
http://www.davidschure.com/Untitled-2.html
http://www.davidschure.com/Untitled-2.html
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
return this;
}
$(document).ready(function() {
$("#thumbnail img").click(function(e){
$("#background").css({"opacity" : "0.7"})
.fadeIn("slow");
$("#large").html("<img src='"+$(this).parent().attr("href")+"' alt='"+$(this).attr("alt")+"' /><br/>"+$(this).attr("rel")+"")
.center()
.fadeIn("slow");
return false;
});
$(document).keypress(function(e){
if(e.keyCode==27){
$("#background").fadeOut("slow");
$("#large").fadeOut("slow");
}
});
$("#background").click(function(){
$("#background").fadeOut("slow");
$("#large").fadeOut("slow");
});
$("#large").click(function(){
$("#background").fadeOut("slow");
$("#large").fadeOut("slow");
});
});
</script>
<style>
img {
border: none;
}
#thumbnail img {
cursor: pointer;
}
#large {
display: none;
position: absolute;
background: #FFFFFF;
padding: 5px;
z-index: 10;
min-height: 400px;
min-width: 600px;
color: #336699;
}
#background{
display: none;
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
background: #000000;
z-index: 1;
}
</style>
</head>
<body>
<div align="center">
<div id="thumbnail">
<h3>Click on the image</h3>
<a href="images/addtocartpng.png"><img src="images/addtocartpng.png" width="124" height="100" rel="OK"/></a>
<!--p id="large"></p-->
</div>
<div id="large"></div>
<div id="background"></div>
</div>
</body>
</html>
ASKER
I changed it. But I am getting an error in the syntax on this line...
$("#large").html[b]("hello world")[/b]
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
LOL, I thought that looked funny! Works perfectly! Thank you!
Open in new window
THIS LINE >>>> $("#large").html("hello world")
Insert whatever you want the white div to contain in that line.