CSS + DIV for dynamic image display (perfect version)

Source: Internet
Author: User

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Head>

<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>

<Title> Show Photo </title>

<Script type = "text/javascript" language = "javascript">

Function ImageDivMouseOver (obj)

{

Document.getelementbyid(obj).style.left?##event.x=1520.document.doc umentElement. scrollLeft;

Document.getelementbyid(obj).style.top;{{event.y}15}document.doc umentElement. scrollTop;

}

</Script>

<Style type = "text/css">

. ShowImage {

Display: block;/** // * display the link in blocks so that the link can respond to the link without clicking the link text */

}

. ShowImage a img {

Display: none; visibility: hidden;/** // * the initialization information panel does not display */

}

. ShowImage a: hover {_ border: none; text-decoration: none;}/** // A State pseudo-class bug in IE7 or earlier versions */

. ShowImage a: hover img {

Display: block;

Visibility: visible;

Position: absolute;

Display: block;

Width: 139px;/** // only the width is given, and the height is automatically adjusted as the content */

Border: 1px solid rgb (91,185,233 );

Background-color: rgb (228,246,255 );

Z-index: 999;/** // indicates the information panel to a high position, so that the link text does not overlap with the Panel when it is too long, but this is only valid for FF */

}

. ShowImage a img {

Border: none;/** // * remove the image border. By default, the image in the link will appear in the standard browser */

Display: block;

Position: absolute;/** // use absolute positioning to extract normal text streams. Otherwise, it will be more difficult to view the normal display of different browsers during design */

Left: 80px;

Top: 30px;

}

. ImgStyle {z-index: 10px; position: absolute}

</Style>

</Head>

<Body>

<Form>

<Div style = "height: 700px;"> </div>

<Div class = "showImage"> <a href = "#" onmouseover = "ImageDivMouseOver ('img1 ') "> link to the first image display </img> </a>

<Br/>

<A href = "#" onmouseover = "ImageDivMouseOver ('img2 ') "> link to the second image </a>

<Br/>

<A href = "#" onmouseover = "ImageDivMouseOver ('img3 ') "> third picture display link </a> </div>

</Form>

</Body>

</Html>

Optimized content:

1. Follow the mouse

2. added the scroll bar considerations.

3. display at the beginning of the image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.