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

実行結果

Mootools - Product Highlights! | 設置サンプル

DOUGHNUTS
CAKE
CAFEEAT

▲サムネイル画像にマウスオーバーすると拡大画像が表示されます。

設置サンプルのソース

<!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>Mootools - Product Highlights! | 設置サンプル</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <script src="/content/lib/mootools/mootools-1.2-core-yc.js" type="text/javascript"></script>
      <script src="/content/lib/mootools/mootools-1.2-more.js" type="text/javascript"></script>
      <script type="text/javascript">
         window.addEvent('domready', function() {
            /* Create variables (in this case two arrays) representing our bubbles and pages */
            var myPages=$$('.page');
            var myBubbles=$$('.bubble');
            /* Set bubbles opacity to zero so they're hidden initially and toggle visibility on for their container   */
            myBubbles.setStyle('opacity', 0);
            $('bubbleWrap').setStyle('visibility','visible')
            /* Add our events to the pages */
            myPages.each(function(el, i) {
               el.set('morph', {link:'cancel'});
               el.addEvents({
                  'mouseenter':function(){ myBubbles[i].morph({'opacity':1,'margin-top':'-15px'}); },
                  'mouseleave':function(){ myBubbles[i].morph({'opacity':0,'margin-top':0}); }
               });
            });
         });
      </script>
      <style type="text/css">
         #siteWrap { width:318px; height:315px; position:relative; background:#000; margin-bottom:1em; overflow:hidden; }
         #pageWrap { position:absolute; z-index:5; top:240px; left:0; }
         #psdPage { margin-right:0; float:left; cursor:pointer; }
         #netPage { margin-right:0; float:left; cursor:pointer; }
         #audioPage { float:left; cursor:pointer; }
         #bubbleWrap { position:absolute; z-index:10; left:0; top:15px; }
         .bubble { position:absolute; }
         .bubble img { width:318px; height:240px; display:block; }
         .clear { clear:both; }
         .page { width:106px; height:75px; display:block;}
         .page img { width:100%; }
      </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>
      <h1><a href='http://nettuts.com/javascript-ajax/create-a-simple-powerful-product-highlighter-with-mootools/'>Mootools - Product Highlights!</a> | 設置サンプル</h1>
      <div id="siteWrap">
         <div id="bubbleWrap" style="visibility: hidden;">
            <div class="bubble"><img src="http://farm4.static.flickr.com/3141/2973155055_4cf4370939.jpg" alt="DOUGHNUTS" /></div>
            <div class="bubble"><img src="http://farm4.static.flickr.com/3222/2974008614_736e2d5b50.jpg" alt="CAKE" /></div>
            <div class="bubble"><img src="http://farm4.static.flickr.com/3174/2973352946_d3589b717e.jpg" alt="CAFEEAT" /></div>
         </div>
         <div id="pageWrap">
            <div class="page" id="psdPage"><a href="#"><img src="http://farm4.static.flickr.com/3141/2973155055_4cf4370939_t.jpg" alt="DOUGHNUTS" /></a></div>
            <div class="page" id="netPage"><a href="#"><img src="http://farm4.static.flickr.com/3222/2974008614_736e2d5b50_t.jpg" alt="CAKE" /></a></div>
            <div class="page" id="audioPage"><a href="#"><img src="http://farm4.static.flickr.com/3174/2973352946_d3589b717e_t.jpg" alt="CAFEEAT" /></a></div>
         </div>
      </div>
      <p>▲サムネイル画像にマウスオーバーすると拡大画像が表示されます。</p>
   </body>
</html>