▼画像にマウスオーバーすると、半透明のキャプションが表示されます。
<!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" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>Easy way to improve your image gallery using jQuery | 設置サンプル</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <!-- JS --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> $(function() { $("a").mouseover(function(){ $(this).find(".textPlaceholder").show(); }).mouseout(function(){ $(this).find(".textPlaceholder").hide(); }); }); </script> <!-- CSS --> <style type="text/css"> ul { margin:0px; padding:0px; } li { list-style-type:none; float:left; margin:15px; position:relative; padding:0px; } li a { display:block; } .textPlaceholder { position:absolute; /* height + top = 画像の高さ */ width:100%; height:50px; top:130px; left:0; margin:0; padding:0; color:#fff; font-weight:bold; text-decoration:none; background-color:#000; opacity:0.6; filter: alpha(opacity=50); display:none; cursor:pointer; } .textPlaceholder div { padding:10px; } .textPlaceholder span { display:block; text-align:right; font-size:.8em; font-weight:normal; } </style> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <div id="wrap"> <h1><a href='http://www.jankoatwarpspeed.com/post/2008/09/03/Easy-way-to-improve-your-image-gallery-using-jQuery.aspx'>Easy way to improve your image gallery using jQuery</a> | 設置サンプル</h1> <p>▼画像にマウスオーバーすると、半透明のキャプションが表示されます。</p> <!-- CODE --> <div class="cf"> <ul> <li> <a href="http://www.flickr.com/photos/22559849@N06/2974008614/"> <img src="http://farm4.static.flickr.com/3222/2974008614_736e2d5b50_m.jpg" alt="くまさんケーキ" /> <div class="textPlaceholder"> <div>くまさんケーキ<span>by PHP & JavaScript Room</span></div> </div> </a> </li> <li> <a href="http://www.flickr.com/photos/22559849@N06/2973155055/"> <img src="http://farm4.static.flickr.com/3141/2973155055_4cf4370939_m.jpg" alt="クリスピー・クリーム・ドーナツ" /> <div class="textPlaceholder"> <div>クリスピー・クリーム・ドーナツ<span>by PHP & JavaScript Room</span></div> </div> </a> </li> </ul> </div> <!-- /CODE --> </div> </body> </html>