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

実行結果

Lightweight Image Gallery with Thumbnails | 設置サンプル

設置サンプルのソース

<!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>Lightweight Image Gallery with Thumbnails | 設置サンプル</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <!-- CSS -->
      <style type="text/css">
         #jgal { list-style:none; width:200px; position:relative; }
         #jgal li { opacity:0.5; float:left; display:block; width:60px; height:60px; background-position:50% 50%; cursor:pointer; border:3px solid #fff; outline:1px solid #ddd; margin-right:14px; margin-bottom:14px; }
         #jgal li img { position:absolute; top:0; left:220px; display:none; border:3px solid #fff; outline:1px solid #ddd; }
         #jgal li.active img { display: block; }
         #jgal li.active, #jgal li:hover { outline-color:#bbb; opacity:0.99 /* safari bug */ }
         #gallery { list-style: none; display: block; }
         #gallery li { float: left; margin: 0 10px 10px 0; }
         #gallery { display: none; }
      </style>
      <!--[if lt IE 8]>
      <style media="screen,projection" type="text/css">
         #jgal li { filter: alpha(opacity=50); }
         #jgal li.active, #jgal li:hover { filter: alpha(opacity=100); }
      </style>
      <![endif]-->
      <!-- JS -->
       <script type="text/javascript">document.write("<style type='text/css'> #gallery { display: none; } </style>");</script>
       <!--[if lt IE 6]><style media="screen,projection" type="text/css">#gallery { display: block; }</style><![endif]-->
       <script type="text/javascript">
         var gal = {
             init : function() {
                 if (!document.getElementById || !document.createElement || !document.appendChild) return false;
                 if (document.getElementById('gallery')) document.getElementById('gallery').id = 'jgal';
                 var li = document.getElementById('jgal').getElementsByTagName('li');
                 li[0].className = 'active';
                 for (i=0; i<li.length; i++) {
                     li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')';
                     li[i].style.backgroundRepeat = 'no-repeat';
                     li[i].title = li[i].getElementsByTagName('img')[0].alt;
                     gal.addEvent(li[i],'click',function() {
                         var im = document.getElementById('jgal').getElementsByTagName('li');
                         for (j=0; j<im.length; j++) {
                             im[j].className = '';
                         }
                         this.className = 'active';
                     });
                 }
             },
             addEvent : function(obj, type, fn) {
                 if (obj.addEventListener) {
                     obj.addEventListener(type, fn, false);
                 }
                 else if (obj.attachEvent) {
                     obj["e"+type+fn] = fn;
                     obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
                     obj.attachEvent("on"+type, obj[type+fn]);
                 }
             }
         }
         gal.addEvent(window,'load', function() {
             gal.init();
         });
       </script>
   <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><a href='http://monc.se/kitchen/80/lightweight-image-gallery-with-thumbnails'>Lightweight Image Gallery with Thumbnails</a> | 設置サンプル</h1>
<!-- CODE -->
         <ul id="gallery">
             <li><img src="http://farm4.static.flickr.com/3222/2974008614_736e2d5b50.jpg" alt="くまさんケーキ" /></li>
             <li><img src="http://farm4.static.flickr.com/3141/2973155055_4cf4370939.jpg" alt="クリスピー・クリーム・ドーナツ" /></li>
             <li><img src="http://farm4.static.flickr.com/3174/2973352946_d3589b717e.jpg" alt="CAFE EAT代官山S" /></li>
             <li><img src="http://farm4.static.flickr.com/3025/2971768652_b9b3b7ddda.jpg" alt="Giottoのケーキ"></li>
             <li><img src="http://farm3.static.flickr.com/2339/2232216935_329eaf9a20.jpg" alt="ランチ@チャオタイ"></li>
         </ul>
         <div style="float:none; clear:both;"></div>
<!-- / CODE -->
      </div>
   </body>
</html>