Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Javascript - Image Popup
SUBMITTED BY:
Guest
DATE:
Oct. 8, 2013, 10 p.m.
FORMAT:
JavaScript
SIZE:
1.6 kB
Raw
Download
Tweet
HITS:
1481
Go to comments
Report
<!
DOCTYPE
html
>
<
html
>
<
head
>
<
title
><
/title>
<
style
>
#
Container
{
width
:
100
%
;
height
:
100
%
;
}
#
Thumbs
,
#
BigImgDiv
{
width
:
100
%
;
height
:
100
%
;
position
:
absolute
;
}
#
BigImgDiv
{
background
-
color
:
black
;
z
-
index
:
1
;
left
:
0
px
;
top
:
0
px
;
display
:
none
;
}
#
BigImg
{
position
:
absolute
;
margin
:
auto
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
}
<
/style>
<
script
>
function
expandImage
(
image
)
{
var
bigDiv
=
document
.
getElementById
(
"BigImgDiv"
);
bigDiv
.
innerHTML
=
"<img src='"
+
image
+
"' id='BigImg' />"
;
bigDiv
.
style
.
display
=
"block"
;
}
function
hideImage
()
{
var
bigDiv
=
document
.
getElementById
(
"BigImgDiv"
);
bigDiv
.
style
.
display
=
"none"
;
}
<
/script>
<
/head>
<
body
>
<
div
id
=
"Container"
>
<
div
id
=
"BigImgDiv"
onclick
=
"hideImage();"
><
/div>
<
div
id
=
"Thumbs"
>
<
img
src
=
"image1.png"
onclick
=
"expandImage('bigimage1.png');"
/>
<
img
src
=
"image2.png"
onclick
=
"expandImage('bigimage2.png');"
/>
<
/div>
<
/div>
<
/body>
<
/html>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus