Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library
Submit an original CSS code
CSS Layouts
Web Graphics
Online Tools:

Advertise Here

CSS Library: Image CSS: Here

CSS Popup Image Viewer

Author: Dynamic Drive

Enable arbitrary links or image thumbnails to pop up an enlarged (different) image onMouseover by using this CSS code. With the help of CSS's ":hover" pseudo class, combined with relative and absolute positioning, the enlarged images are simply included on the page as normal HTML, "popping" up on demand. CSS is behaving more and more like scripting!

Demo:

One of my favorite foods is sushi
Doesn't this look good?
, and it's good for you too! Coffee and sushi probably don't mix well, but I like some Zoka Coffee
Zoka Coffee
to boot! Here are some thumbnails from my trip to La la land:


Simply beautiful.

So real, it's unreal. Or is it?

The CSS:

The HTML:

Code Info

Rate this code:

Date Posted: 05/07/2006

Revision History: None

Usage Terms: Click here

Your Comments (524)

Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.

Comment Pages 16 of 53 pages « First  <  14 15 16 17 18 >  Last »

Is there anyway to target this to open in a seperate frame that is part of the page?
Posted by Ryan on 03/05, 11:30 PM
hi. this is amazing and i LIKE it !!
but is there anyway to avoid loading the larger image when the page loads ?
i mean the larger image loads when it is hovered.
Posted by Ali Sarshad on 03/06, 07:13 AM
I'm using an ASP.NET datalist so my images come from this:

ImageUrl='<%# eval("Image01") %>'

How do I get the <a href="#thumb" to live happily with ImageURL in my datalist?
Posted by Karen on 03/06, 11:59 AM
I am using the pop up image viewer code (from this site) for flash.swf files. This works very nicely in all browsers (Mac and PC) except Firefox on a PC. (it does work in firefox on a MAC). Can anyone please help?

<td><a class="thumbnail" href="#thumb"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="148" height="22">


<embed src="tips.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="148" height="22"></embed></object><span><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="148" height="22">


<embed src="tips1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="148" height="22"></embed></object>
Posted by Linda Rockhill on 03/06, 09:04 PM
its fine and I am going to use, and one more can u please modify on click action for this,
Posted by manjunath on 03/08, 11:18 PM
ASP.NET answer:

<a class="thumbnail" href="#thumb">

<asp:Image ID="Image2"
CssClass="thumbnail"
runat="server"
EnableViewState="true"
AlternateText="Salvage"
ImageUrl='<%# eval("Image01") %>'
Width="60px"
Height="80px"
BorderStyle="Solid"
BorderWidth="1px"
style="left: 0px; top: 1px"
BorderColor="SaddleBrown" >

<span>

$ <%# eval("Price", "{0:C}") %>
<%#eval("Image02")% >
</span>
</a>
Posted by Karen on 03/08, 11:34 PM
The bottom description under the enlarged image seems to break in IE6. Is there a fix for that?
Posted by Josh on 03/12, 11:45 PM
This is exactly what I have been looking for! Can anyone tell me if there is a way to make the position for each thumbnail relative to the picture, rather than cemented for each one? I have a gallery of images inside a frame, and I would like the popup image to appear in the center of the frame, rather than always to the left of the image. Is this possible?
Posted by Kat on 03/23, 12:10 PM
To answer my own question (I found the answer on page... 6 of these comments..)

To set a definate position for a gallery of images (say, 10 thumbs across, and 3 thumbs deep) to open all of their enlarged images in the same place (like the center of the page)... add

position:fixed;

just below

.thumbnail:hover span{ /*CSS for enlarged image on hover*/

and above

visibility: visible;
top: 0;
left: 250px; /*position where enlarged image should offset horizontally */

}

You can see that I changed left: 60pix to 250.. that is because I have a 700px Iframe that my gallery is loading in. This lets my 200px wide image load in the center of the iframe.

_________________________

I have seen this posted 2 times, but not addressed.. is there a way to make the enlarged image disappear when your mouse leaves the thumbnail? Rather than staying open with the mouse over the enlarged image? It's kind of a pain to have to run your mouse to the top/bottom/side of the page each time to get the popup image to disappear.
Posted by Kat on 03/23, 07:14 PM
How do I keep my images from popping up off of the page?
Posted by Brent on 04/01, 01:15 AM

Comment Pages 16 of 53 pages « First  <  14 15 16 17 18 >  Last »

Commenting is not available in this weblog entry.
Copyright 2006-2008 Dynamic Drive Read our Usage Terms before using any of the CSS codes.
Dynamic Drive DHTML and CSS Code Library