日期:2014-05-16 浏览次数:20326 次
<!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"> <html> <title></title> <head> <script type="text/javascript" src="../jquery-1.8.0.js"> $(function(){ var x,y=10; $("a").mouseover(function(e){ var view="<div class='view'><img src='"+this.href+"'/> </div>";//新建div图片节点 $("body").append(view); //插入节点 $(".view") .css({ "left":(e.pageX+x)+"px",//图片位置 "top":(e.pageY+y)+"px" }).show("fast") }).mouseout(function(){ $(".view").remove(); }).mousemove(function(e){ $(".view") .css({ "top": (e.pageY+y) + "px", "left": (e.pageX+x) + "px" }); }) </script> <style type="text/css"> ul { margin:0;padding:0;} li { margin:18px; border:3px solid #ffff00; float:left; } img { width:130px; height:180px; display:block; border:none; } </style> </head> <body> <ul> <li><a href="./img/001.jpg" > <img src="./img/s_001.jpg" /> </a></li> <li><a href="./img/002.jpg" > <img src="./img/s_002.jpg" /> </a></li> <li><a href="./img/003.jpg" > <img src="./img/s_003.jpg" /> </a></li> <li><a href="./img/004.jpg" > <img src="./img/s_004.jpg" /> </a></li> <li><a href="./img/005.jpg" > <img src="./img/s_005.jpg" /> </a></li> <li><a href="./img/006.jpg" > <img src="./img/s_006.jpg" /> </a></li> <li><a href="./img/007.jpg" > <img src="./img/s_007.jpg" /> </a></li> <li><a href="./img/008.jpg" > <img src="./img/s_008.jpg" /> </a></li> <li><a href="./img/009.jpg" > <img src="./img/s_009.jpg" /> </a></li> <li><a href="./img/010.jpg" > <img src="./img/s_010.jpg" /> </a></li> <li><a href="./img/011.jpg" > <img src="./img/s_011.jpg" /> </a></li> <li><a href="./img/012.jpg" > <img src="./img/s_012.jpg" /> </a></li> </ul> </body> <html>
$(function(){ var x,y=10; $("a").mouseover(function(e){ var view="<div class='view'><img src='"+this.href+"'/> </div>";//新建div图片节点 $("body").append(view); //插入节点 $(".view") .css({ "left":(e.pageX+x)+"px",//图片位置 "top":(e.pageY+y)+"px" }).show("fast") }).mouseout(function(){ $(".view").remove(); }).mousemove(function(e){ $(".view") .css({ "top": (e.pageY+y) + "px", "left": (e.pageX+x) + "px"