CSS based popup that displays image on mouseover, for your web page

Jan 31 2008  | Views 1672 |  Comments  (0) Leave a Comment
Tags:

I was in the process of completing a web page for a client. And there was this requirement to display an image when the visitor brought his/her mouse over a hyperlink. Very simple, you say. Use a javascript or a html window.

But, there I sas two issues to it:
  • Aesthetics
    • They do not look very good on your page
  • Popup-blockers
    • Since, there are popup blockers installed in almost every browser these days, any regular use of popups was bound to be blocked
I tried a few javascript based popups on my site. They were either suppressed by the browser, or not very attractive to look at.

After many a search, I had a serendipitous encounter with style sheet based popups (CSS) that look pleasant and rich and will display on any browser... I think.

Here is the link to the site which contains the stylesheet and the html code for embedding images that would popup with a mouse over the link.

Try it, it's really Cool!

http://www.dynamicdrive.com/style/csslibrary/item/css-popup-image-viewer/

The effect can be seen below:



Simply beautiful.



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



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
In case the link goes dead, get your code below:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

The CSS Code: >>>Starts below
<style type="text/css">

/*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: absolute;
background-color: lightyellow;
padding: 5px;
left: -1000px;
border: 1px dashed gray;
visibility: hidden;
color: black;
text-decoration: none;
}

.thumbnail span img{ /*CSS for enlarged image*/
border-width: 0;
padding: 2px;
}

.thumbnail:hover span{ /*CSS for enlarged image on hover*/
visibility: visible;
top: 0;
left: 60px; /*position where enlarged image should offset horizontally */
}
</style>
The CSS Code: >>>Ends above

The HTML Code: >>>Starts below
<a class="thumbnail" href="#thumb"><img src="http://www.dynamicdrive.com/cssexamples/media/tree_thumb.jpg" width="100px" height="66px" border="0" /><span><img src="http://www.dynamicdrive.com/cssexamples/media/tree.jpg" /><br />Simply beautiful.</span></a>

<a class="thumbnail" href="#thumb"><img src="http://www.dynamicdrive.com/cssexamples/media/ocean_thumb.jpg" width="100px" height="66px" border="0" /><span><img src="http://www.dynamicdrive.com/cssexamples/media/ocean.jpg" /><br />So real, it's unreal. Or is it?</span></a>

<br />
<br />

<a class="thumbnail" href="#thumb">Dynamic Drive<span><img src="http://www.dynamicdrive.com/cssexamples/media/dynamicdrive.gif" /><br />Dynamic Drive</span></a><br />
<a class="thumbnail" href="#thumb">Zoka Coffee<span><img src="http://www.dynamicdrive.com/cssexamples/media/zoka.gif" /><br />Zoka Coffee</span></a>
The HTML Code: >>>Ends above
© chanakyageo., all rights reserved.

Recommend

votesEnjoyed this post? Cast your vote and recommend to other readers

Leave a comment


In case you missed...


Advertisement


Chennai, Male
Member Since Apr 18 2003
© 1998-2008 Copyright Sulekha.com Connecting Indians Worldwide, All Rights Reserved.