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

実行結果

設置サンプル

参照:Animate Curtains Opening with jQuery

設置サンプルのソース

<!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 type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      <script type="text/javascript" src="/content/lib/jquery/jquery.easing.1.3.js"></script>
      <script type="text/javascript">
         $(function(){
         $curtainopen = false;
            $(".rope").click(function(){
               $(this).blur();
               if ($curtainopen == false){ 
                  $(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'}); 
                  $(".leftcurtain").stop().animate({width:'60px'}, 2000 );
                  $(".rightcurtain").stop().animate({width:'60px'},2000 );
                  $curtainopen = true;
               }else{
                  $(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'}); 
                  $(".leftcurtain").stop().animate({width:'50%'}, 2000 );
                  $(".rightcurtain").stop().animate({width:'51%'}, 2000 );
                  $curtainopen = false;
               }
               return false;
            });
         });
      </script>
      <!-- CSS -->
      <style type="text/css">
          #container {
             text-align:center;
             background:#4f3722 url('/content/img/ajax/curtains/darkcurtain.jpg') repeat-x;
             position:relative;
             height:495px;
          }
          .leftcurtain{
            width:50%; height:495px;
            top:0; left:0;
            position: absolute;
            z-index: 2;
         }
          .rightcurtain{
            width:51%; height:495px;
            right:0; top:0;
            position:absolute;
            z-index:3;
         }
         .rightcurtain img,
         .leftcurtain img{
            width:100%; height:100%;
         }
         .logo{
            margin:100px auto 0 auto;
         }
         .rope{
            position:absolute;
            top:-40px; left:70%;
            z-index:4;
         }
      </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://buildinternet.com/2009/07/animate-curtains-opening-with-jquery/'>Animate Curtains Opening with jQuery</a></p>
<!-- CODE -->
         <div id="container">
            <div class="leftcurtain"><img src="/content/img/ajax/curtains/frontcurtain.jpg"/></div>
            <div class="rightcurtain"><img src="/content/img/ajax/curtains/frontcurtain.jpg"/></div>
            <img class="logo" src="/content/img/ajax/curtains/logo.png"/>
            <a class="rope" href="#">
               <img src="/content/img/ajax/curtains/rope.png"/>
            </a>
         </div>
<!-- CODE / -->
      </div>
   </body>
</html>