<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>图片信息描述</title> <style type="text/css"> ul{ margin:0; padding:0; list-style:none; } ul li{ float:left; margin-left:10px; padding:2px; width:100px; height:100px; box-shadow:0 0 5px gray; } img{ position:relative; z-index:-10; } a{ display:block; margin-top:-25px; background:rgba(0,0,0,0.5); color:#fff; text-align:center; } </style> <script type="text/javascript" src="../js/jquery.js"></script> </head> <body> <ul> <li><img src="../images/65.gif" width="100" height="100" alt="嘿嘿" title="嘿嘿" /></li> <li><img src="../images/64.gif" width="100" height="100" alt="哈哈" title="哈哈" /></li> <li><img src="../images/63.gif" width="100" height="100" alt="呵呵" title="呵呵" /></li> <li><img src="../images/62.gif" width="100" height="100" alt="咪咪" title="咪咪" /></li> </ul> </body> <script type="text/javascript"> $(function(){ $("li").hover(function(){ var myTitle=$(this).children("img").attr("title"); $(this).css("box-shadow","0 0 5px red inset"); $(this).append("<a>" + myTitle + "</a>"); },function(){ $(this).css("box-shadow","0 0 5px gray"); $(this).children("a").remove(); }); }); </script> </html>
jquery图片信息提示
最新推荐文章于 2018-09-09 15:48:00 发布