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

実行結果

エフェクト操作:カスタム:animate(params, options)の使用例 | jQuery

例:水平型アコーディオン

参照:jQuery Examples - Horizontal Accordion

設置サンプルのソース

<!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>エフェクト操作:カスタム:animate(params, options)の使用例 | jQuery</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      <script type="text/javascript">
         $(function(){
            lastBlock=$("#a1");
            maxWidth=210;
            minWidth=106;   
            $("ul li a").hover(
               function(){
                  $(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
                  $(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
                  lastBlock=this;
               }
            );
         });
      </script>
      <style type="text/css">
         ul         { list-style:none; margin:0; padding:0; }
         ul li      { list-style:none; float:left; padding:0 0 5px 0; display:block; margin-right:10px; background:#000 url("/content/img/ajax/line_btm.png") repeat-x bottom left; overflow:hidden; }
         ul li a      { margin:0; padding:15px 10px 10px 10px; display:block; overflow:hidden; height:82px; width:106px; color:orange; background:#000 url("/content/img/ajax/line_top.png") repeat-x 0 0; }
         ul li img   { position:absolute; border:3px solid #ff6600; }
         ul li p      { margin:0; padding:0; display:block; margin-left:116px; width:106px; }
         #a1         { width:210px; }
      </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>エフェクト操作:カスタム:animate(params, options)の使用例 | jQuery</h1>
         <h2>例:水平型アコーディオン</h2>
         <p>参照:<a href='http://designreviver.com/tutorials/jquery-examples-horizontal-accordion/'>jQuery Examples - Horizontal Accordion</a></p>
<!-- CODE -->
         <div class="cf">
            <ul>
               <li>
                  <a id="a1">
                     <img src="http://farm4.static.flickr.com/3327/3190782567_01fd8855f0_t.jpg" />
                     <p><strong>出会い</strong><br>@みかん星人</p>
                  </a>
                  </li>
               <li>
                  <a>
                     <img src="http://farm4.static.flickr.com/3336/3190782595_f789def132_t.jpg" />
                     <p><strong>チュッ</strong><br>@みかん星人</p>
                  </a>
               </li>
               <li>
                  <a>
                     <img src="http://farm4.static.flickr.com/3317/3191630438_f057b231a3_t.jpg" />
                     <p><strong>合体</strong><br>@みかん星人</p>
                  </a>
               </li>
            </ul>
         </div>
<!-- / CODE -->
      </div>
   </body>
</html>