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

実行結果

設置サンプル

animation-fill-mode

animation-direction:   

animation-iteration-count:       

animation-fill-mode:   

Sample

設置サンプルのソース

<!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>animation-fill-mode</title>
      <link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
      <script type="text/javascript" src="./js/jquery.vendorprefix.js"></script>
      <script type="text/javascript">
         $(function(){
            $("input[type=radio]").click(function(){
               var _direction=$("input:radio[name=r3]:checked").val();
               var _count=$("input:radio[name=r2]:checked").val();
               var _mode=$("input:radio[name=r1]:checked").val();
               var prefix=$.fn.VendorPrefix();
               var rint = Math.round(0xffffff * Math.random());
               var rgb='rgb(' + (rint >> 16) + ',' + (rint >> 8 & 255) + ',' + (rint & 255) + ')';
               
               $("#sample").find("p").remove();
               var $obj=$("<p>Sample</p>").appendTo("#sample");
               $obj.css("background-color",rgb);

               $obj.css("animation-direction",_direction);
               $obj.css(prefix+"animation-direction",_direction);

               $obj.css("animation-iteration-count",_count);
               $obj.css(prefix+"animation-iteration-count",_count);

               $obj.css("animation-fill-mode",_mode);
               $obj.css(prefix+"animation-fill-mode",_mode);
            });
          });
      </script>
      <style type="text/css">
         #sample {
            width:500px; height:300px;
            background:#eee;
         }
         #sample p {
            margin:0; padding:0;
            width:100px; height:100px;
            background:#ccc;
            position:relative;
            line-height:100px;
            text-align:center;
            font-weight:bold;
            
            animation:myani 2s linear 1s 1 normal; /* CSS3 */
            -webkit-animation:myani 2s linear 1s 1 normal; /* Chrome, Safari */
            -moz-animation:myani 2s linear 1s 1 normal; /* Firefox */
            -ms-animation:myani 2s linear 1s 1 normal; /* IE */
            -o-animation:myani 2s linear 1s 1 normal; /* Opera */
         }
         @keyframes myani {
             from {left:0px;}
             to {left:400px;}
         }
         @-webkit-keyframes myani {
             from {left:0px;}
             to {left:400px;}
         }
         @-moz-keyframes myani {
             from {left:0px;}
             to {left:400px;}
         }
         @-ms-keyframes myani {
             from {left:0px;}
             to {left:400px;}
         }
         @-o-keyframes myani {
             from {left:0px;}
             to {left:400px;}
         }
      </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>
         <h2>animation-fill-mode</h2>
<!-- CODE -->
         <p id="rgrp3">
            animation-direction: 
            <label for="r31"><input type="radio" name="r3" id="r31" value="normal" checked="checked">normal</label> 
            <label for="r32"><input type="radio" name="r3" id="r32" value="alternate">alternate</label>
         </p>
         <p id="rgrp2">
            animation-iteration-count: 
            <label for="r21"><input type="radio" name="r2" id="r21" value="1" checked="checked">1</label> 
            <label for="r22"><input type="radio" name="r2" id="r22" value="2">2</label> 
            <label for="r23"><input type="radio" name="r2" id="r23" value="3">3</label> 
            <label for="r24"><input type="radio" name="r2" id="r24" value="infinite">infinite</label>
         </p>
         <p id="rgrp">
            animation-fill-mode: 
            <label for="r11"><input type="radio" name="r1" id="r11" value="none" checked="checked">none</label> 
            <label for="r12"><input type="radio" name="r1" id="r12" value="forwards">forwards</label>
            <label for="r13"><input type="radio" name="r1" id="r13" value="backwords">backwords</label>
            <label for="r14"><input type="radio" name="r1" id="r14" value="both">both</label>
         </p>
         <div id="sample">
            <p>Sample</p>
         </div>
<!-- CODE / -->
      </div>
   </body>
</html>