PHP & JavaScript Room :: 設置サンプル

実行結果

設置サンプル

参照:Build a Better Tooltip with jQuery Awesomeness

▼写真にマウスオーバーでツールチップ表示

設置サンプルのソース

<!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>設置サンプル</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.4.2/jquery.min.js" ></script>
      <script type="text/javascript" src="/content/lib/jquery/better_tooltip/jquery.betterTooltip.js" ></script>
      <script type="text/javascript">
         $(function() {
            $('.tTip').betterTooltip({speed:500, delay:100});
         });
      </script>
      <!-- CSS -->
      <style type="text/css">

.tTip {
   width:200px;
   position:absolute;
   cursor:pointer;
   color:#666;
   font-weight:bold;
}
.tip {
   color:#333;
   width:212px;
   padding-top:22px;
   overflow:hidden;
   display:none;
   position:absolute;
   z-index:500;
   background:transparent url("/content/lib/jquery/better_tooltip/tipTop.png") no-repeat 0 0;
}
.tipMid {
   background:transparent url("/content/lib/jquery/better_tooltip/tipMid.png") repeat-y 0 0;
   margin:0; padding:0 25px 20px 25px;
}
.tipBtm {
   background:transparent url("/content/lib/jquery/better_tooltip/tipBtm.png") no-repeat 0 100%;
   height:22px;
}
#main {
   width:100%; height:240px;
   position:relative;
   margin:100px 30px 10px 30px;
}
#pic1 {
   top:0; left:0;
}
#pic2 {
   top:0; left:240px;
}
#pic3 {
   top:0; left:480px;
}
      </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 &amp; JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
      <div id="wrap">
         <h1>設置サンプル</h1>
         <p>参照:<a href='http://net.tutsplus.com/tutorials/javascript-ajax/build-a-better-tooltip-with-jquery-awesomeness/'>Build a Better Tooltip with jQuery Awesomeness</a></p>
         <p>▼写真にマウスオーバーでツールチップ表示</p>
<!-- CODE -->
         <div id="main">
            <div class="tTip" id="pic1" title="明太子とろろごはん♥ 口がむずがゆくなっても気にしない!"><img src="http://farm5.static.flickr.com/4012/5150664727_b8f80eda81_m.jpg" /></div>
             <div class="tTip" id="pic2" title="すき焼きといえばシナチクだよねん♥ うどんこ成分Love♥"><img src="http://farm2.static.flickr.com/1261/5154145734_dd6d41721d_m.jpg" /></div>
             <div class="tTip" id="pic3" title="ぐつぐつおでん♩ 一番すきなのは大根とほとんど崩れかかったジャガイモ。"><img src="http://farm2.static.flickr.com/1164/5157648985_87c8a86b9f_m.jpg" /></div>
         </div>
<!-- / CODE -->
      </div>
   </body>
</html>