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 38 of 53 pages « First  <  36 37 38 39 40 >  Last »

cool..awsome.. i like it.. and also i like your site very mutch
Posted by instinct on 07/01, 12:04 AM
Brilliant thing this See bottom of page for the problem and all Ok on a MAC but on a PC it disappears could there be a problem with positioning in a flexible centre area and having to give it a place that is not too far right ?
Advice greatly appreciated
Posted by Mike on 07/01, 09:00 AM
I LOVE YOU! Thanks so much for posting this. (jumping up and down!)
EXACTLY what was needed for this non-profit feline rescue site and so slick without javascript! I now have to wrestle the CSS to put it where I want, but the effect is GREAT!

It left highlighted code in my Dreamweaver window when I added it to the head of this page, so I put it into the main .css doc, and that worked better for me.

I figured out that the attribute
left: 60px; /*position where enlarged image should offset horizontally */
is where i needed to move the resultant image to the other side by using 512px

now to figure out how to move it UP... Gawd, I hate CSS. :)
AHA, it's here...
.thumbnail:hover span{ /*CSS for enlarged image on hover*/
visibility: visible;
top: -100;
/*top: 0;*/


TRA-LA-LA!!!
Posted by woodsnwind on 07/02, 06:31 PM
CSS Popup Image Viewer

Works beautifully, except cannot get thumbnail image to post. Enlargement works fine. Have tried renaming, etc. Checked code carefully. Any suggestions?
Posted by J.Rogers on 07/05, 06:50 PM
Can i use it on Wordpress? Any ideas?
Posted by bas on 07/14, 01:24 PM
It would be good if it was able to open a new page in place of the larger image.
Posted by Mike on 07/14, 07:56 PM
Is it possible to link the larger image to another web page?
Posted by KW on 07/15, 10:53 PM
I tweeked the code to do exactly what I wanted. I got it to fix itself in the screen so that none of the popup image would be off screen and found out how to position it in the screen. Now when I have multiple thumbnails on sceen, I can see all the popouts without having to scroll up or down. Just took some experimentation. I also set the height of the image so it would not exceed the screen.

I placed notes by each attribute I manipulated in the css:
<style type='text/css'>

/* Popout Image Viewer
----------------------------------------------- */
/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */

.thumbnail{
position: relative;
z-index: 0;
}

.thumbnail:hover{
background-color: transparent;
z-index: 50;
}

.thumbnail span{ /*CSS for enlarged image*/
position: fixed; /* set fixed to keep from moving while scrolling */
background-color: #666699;
padding: 2px;
border: 1px solid gray;
visibility: hidden;
color: black;
text-decoration: none;
}

.thumbnail span img{ /*CSS for enlarged image*/
border-width: 0;
padding: 2px;
height: 525px; /* specified to prevent popout from being cut off screen */
}

.thumbnail:hover span{ /*CSS for enlarged image on hover*/
visibility: visible;
top: 25px; /* position where popout will display related to top of browser window */
left: 400px; /* pos where enlarged image should offset horizontally */
}
</style>
Posted by Stoutie on 07/23, 06:44 PM
Thanks for a great example. Use it on my site.

/Per, Giftoverload.com
Posted by Per on 07/27, 02:09 AM
I have been messing with these photo zoom codes on myspace. A nice little challenge since they do weird stuff with their code...IE the # sign cant be used. I have hit a wall, It will roll over, except its not the image that is rolling over. The rest of the page does a rollover. Anyone have any ideas how to get passed this?
Posted by bob on 07/27, 10:30 AM

Comment Pages 38 of 53 pages « First  <  36 37 38 39 40 >  Last »

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