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

実行結果

Widget.Blender | 設置サンプル

デフォルト

鳥小屋

オプション指定あり(fadeDuration:1.0, displayDuration:0.5)

鳥小屋

再生、停止ボタン付き


鳥小屋

ラップなしのオートサイズでブレンド

画像のあるディレクトリを指定して、画像ファイル名を配列で指定し、ツールチップ付き(title属性、alt属性)でギャラリー表示

鳥小屋

設置サンプルのソース

<!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>Widget.Blender | 設置サンプル</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <script type="text/javascript" src="/content/lib/prototype/prototype-1.6.0.3.js"></script>
      <script type="text/javascript" src="/content/lib/scriptaculous/scriptaculous.js?load=effects"></script>
      <script type="text/javascript" src="/content/lib/prototype/blender.js"></script>
      <script type="text/javascript">
         Event.observe(window, "load", function() {
            //Images Array used in all demos
            var images = [
               "http://farm4.static.flickr.com/3138/3032375214_5aedffaca0_m.jpg",
               "http://farm4.static.flickr.com/3064/3031535599_2f8b454232_m.jpg",
               "http://farm4.static.flickr.com/3068/3032375032_aab0a7b581_m.jpg",
               "http://farm4.static.flickr.com/3055/3031535435_6af4618ea1_m.jpg",
               "http://farm4.static.flickr.com/3217/3031535573_6e541be249_m.jpg",
               "http://farm4.static.flickr.com/3223/3032375140_5eba53f7e9_m.jpg",
               "http://farm4.static.flickr.com/3151/3032375106_226d2a6d52_m.jpg",
               "http://farm4.static.flickr.com/3239/3032375082_fd66d11941_m.jpg",
               "http://farm4.static.flickr.com/3177/3032374882_7b7553fff5_m.jpg",
               "http://farm4.static.flickr.com/3171/3032374922_8fcb4ea43d_m.jpg",
               "http://farm4.static.flickr.com/3243/3032374798_cec6385d35_m.jpg"
            ];

            var images2 = [
               "http://farm4.static.flickr.com/3138/3032375214_5aedffaca0_m.jpg",
               "http://farm4.static.flickr.com/3143/3032374956_30e2874e30_m.jpg",
               "http://farm4.static.flickr.com/3064/3031535599_2f8b454232_m.jpg",
            ];

            //Default Blender
            new Blender("defaultDemo", images);

            //Blender with options
            new Blender("optionsDemo", images, {
               fadeDuration:1.0,
               displayDuration:0.5
            });

            //Blender with start and stop
            var startStopBlender = new Blender("startStopDemo", images, { autoStart:false });
            Event.observe("startButton", "click", startStopBlender.start.bind(startStopBlender));
            Event.observe("stopButton", "click", startStopBlender.stop.bind(startStopBlender));

            //Blender with auto sizing
            new Blender("autoSizingDemo", images2, { autoSize:true, noWrap:true });

            //New Features:dir and beforeBlend
            var gallery = [
               { img:"3138/3032375214_5aedffaca0_m.jpg", alt:"サインがいっぱい@鳥小屋" },
               { img:"3064/3031535599_2f8b454232_m.jpg", alt:"レバ刺@鳥小屋" },
               { img:"3068/3032375032_aab0a7b581_m.jpg", alt:"ハツ刺@鳥小屋" },
               { img:"3239/3032375082_fd66d11941_m.jpg", alt:"モツ鍋@鳥小屋" },
               { img:"3217/3031535573_6e541be249_m.jpg", alt:"明太子玉子焼き@鳥小屋" }
            ];
            new Widget.Blender(
               "newFeatures",
               gallery.pluck("img"), {
                  dir:"http://farm4.static.flickr.com/",
                  startIndex:1,
                  beforeBlend:function(oldImg, newImg) {
                     var alt = gallery.find(function(pic) {
                        return newImg.getAttribute("src").slice(-pic.img.length) == pic.img;
                     }).alt;
                     newImg.setAttribute("alt", alt);
                     newImg.setAttribute("title", alt);
                  }
               }
            );

         });
      </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://www.eternal.co.za/scripts/blender/index.html">Widget.Blender</a> | 設置サンプル</h1>

         <h2>デフォルト</h2>
         <img id="defaultDemo" src="http://farm4.static.flickr.com/3243/3032374798_cec6385d35_m.jpg" alt="鳥小屋" />

         <h2>オプション指定あり(fadeDuration:1.0,  displayDuration:0.5)</h2>
         <img id="optionsDemo" src="http://farm4.static.flickr.com/3243/3032374798_cec6385d35_m.jpg" alt="鳥小屋" />

         <h2>再生、停止ボタン付き</h2>
         <button id="startButton">Start</button> <button id="stopButton">Stop</button> <br>
         <img id="startStopDemo" src="http://farm4.static.flickr.com/3243/3032374798_cec6385d35_m.jpg" alt="鳥小屋" />

         <h2>ラップなしのオートサイズでブレンド</h2>
         <div style="position:relative;width:200px;height:200px;padding:4px;margin-top:8px;border:1px solid #000;background:#000;">
            <img id="autoSizingDemo" src="http://farm4.static.flickr.com/3243/3032374798_cec6385d35_m.jpg" width="200" />
         </div>

         <h2>画像のあるディレクトリを指定して、画像ファイル名を配列で指定し、ツールチップ付き(title属性、alt属性)でギャラリー表示</h2>
         <img id="newFeatures" src="http://farm4.static.flickr.com/3217/3031535573_6e541be249_m.jpg" alt="鳥小屋" />
      </div>
   </body>
</html>