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

実行結果

設置サンプル

【参照】jQuery Tooltip @ jQuery TOOLS

基本

 

ツールチップ内にHTML表示

Download now
File sample.zip
Date 2010-01-20
Size 69.1 kB
Download Current Release: v1.0

エフェクト付きツールチップ

 

設置サンプルのソース

<!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 src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      <script type="text/javascript" src="/content/lib/jquery/jquery.tools.min.js"></script>
      <script type="text/javascript">
         $(function(){
            $("#demo img[title]").tooltip('#demotip');
            $("#download_now").tooltip({ effect: 'slide'});
            // initialize tooltip
            $("#dyna img[title]").tooltip({
               // use single tooltip element for all tips
               tip: '#dynatip', 
               // tweak the position
               offset: [10, 2],
               // use "slide" effect
               effect: 'slide'
            // add dynamic plugin 
            }).dynamic( {
               // customized configuration on bottom edge
               bottom: {
                  // slide downwards
                  direction: 'down',
                  // bounce back when closed
                  bounce: true
               }
            });
         });
      </script>
      <style type="text/css">
         #demotip { 
             display:none;
             background:transparent url(/content/img/ajax/black_arrow.png);
             font-size:12px;
             height:70px;
             width:160px;
             padding:25px;
             color:#fff;
         }
         #demo {
            text-align:center;
         }
         #demo img {
            -moz-border-radius:5px;
            -moz-outline-radius:5px;
            border:1px solid #ccc;
            background:#fff;
            padding:5px;
         }
      </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://flowplayer.org/tools/tooltip.html'>jQuery Tooltip @ jQuery TOOLS</a></p>
         <h2>基本</h2>
         <!-- the tooltip -->
         <div id="demotip">&nbsp;</div>
         <!-- and the triggers -->
         <div id="demo">
             <img src="http://farm4.static.flickr.com/3639/3664935712_94ca67b18b_t.jpg" title="サラダ@Au Temps Jadis #1"/>
             <img src="http://farm4.static.flickr.com/3220/3664935670_b94968ccbc_t.jpg" title="ノルディック@Au Temps Jadis #2"/>
             <img src="http://farm4.static.flickr.com/3394/3664935528_16fff63afc_t.jpg" title="塩バターキャラメルのクレープ@Au Temps Jadis #4"/>
         </div>

         <h2>ツールチップ内にHTML表示</h2>
         <style type="text/css">
            /* trigger button */ 
            #download_now { 
               -moz-border-radius:5px;
               -moz-outline-radius:5px;
               border:1px solid #ccc;
               background:#000;
               color:#fff;
               padding:5px;
               text-align:center;
               font-weight:bold;
               margin:20px auto;
                width:159px;
                display:block;
                cursor:pointer;
            }
            /* tooltip styling */ 
            .tooltip { 
                display:none;
                background:url(/content/img/ajax/black_arrow_big.png);
                height:163px;
                padding:40px 30px 10px 30px;
                width:310px;
                font-size:11px;
                color:#fff;
            } 
            /* a .label element inside tooltip */ 
            .tooltip .label { 
                color:yellow;
                width:35px;
            } 
            .tooltip img {
               width:129px; height:102px;
               margin:0 15px 20px 0;
               float:left;
            }
            .tooltip a { 
                color:#ad4;
                font-size:11px;
                font-weight:bold;
            }
         </style>
         <!-- trigger element. a regular workable link -->
         <a id="download_now" title="System tooltip for search engines">Download now</a>
         <!-- tooltip element -->
         <div class="tooltip">
            <img src="/content/img/ajax/129x102.png" />
             <table>
                 <tr>
                     <td class="label">File</td>
                     <td>sample.zip</td>
                 </tr>
                 <tr>
                     <td class="label">Date</td>
                     <td>2010-01-20</td>
                 </tr>
                 <tr>
                     <td class="label">Size</td>
                     <td>69.1 kB</td>
                 </tr>
             </table>
             <a href="#">Download Current Release: v1.0</a>
         </div>

         <h2>エフェクト付きツールチップ</h2>
         <style type="text/css">
            #dynatip {
               display:none;
               background:transparent url(/content/img/ajax/black_arrow.png);
               font-size:12px;
               height:70px;
               width:160px;
               padding:25px;
               color:#fff;   
            }
             
            /* style the trigger elements */
            #dyna {
               text-align:center;
            }
            #dyna img {
               border:0;
               cursor:pointer;
            }
            /* override the arrow image of the tooltip */
            #dynatip.bottom {
               background-image:url(/content/img/ajax/black_arrow_bottom.png);
               padding-top:40px;
               height:55px;
            }
             
            #dynatip.bottom {
               background-image:url(/content/img/ajax/black_arrow_bottom.png);
            }
         </style>
         <!-- use gif image for IE --> 
         <!--[if lt IE 7]>
         <style>
         #dynatip {
            background-image:url(/content/img/ajax/black_arrow_bottom.gif");
         }
          
         #dynatip.bottom {
            background:url(/content/img/ajax/black_arrow_bottom.gif");
         }
         </style>
         <![endif]-->
         <!-- the tooltip --> 
         <div id="dynatip">&nbsp;</div> 
         <!-- a couple of trigger elements --> 
         <div id="dyna">
             <img src="http://farm4.static.flickr.com/3639/3664935712_94ca67b18b_t.jpg" title="サラダ@Au Temps Jadis #1"/>
             <img src="http://farm4.static.flickr.com/3220/3664935670_b94968ccbc_t.jpg" title="ノルディック@Au Temps Jadis #2"/>
             <img src="http://farm4.static.flickr.com/3394/3664935528_16fff63afc_t.jpg" title="塩バターキャラメルのクレープ@Au Temps Jadis #4"/>
         </div>

<!-- / CODE -->
   </body>
</html>