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

実行結果

設置サンプル

参照:Building an animated 3D poll

▼3D棒グラフをアニメーション表示

「メインで使っているブラウザは?」のアンケート結果 - 2010/11/09時点

34%
Chrome
6%
IE
34%
Firefox
7%
Safari
7%
Opera
12%
Lunascape

設置サンプルのソース

<!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 src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
      <script type="text/javascript">
         $(function() {
            $('.bar1').animate({'height':'68%'},1000);
            $('.bar2').animate({'height':'12%'},1000);
            $('.bar3').animate({'height':'68%'},1000);
            $('.bar4').animate({'height':'14%'},1000);
            $('.bar5').animate({'height':'14%'},1000);
            $('.bar6').animate({'height':'24%'},1000);
         });
      </script>
      <!-- CSS -->
      <style type="text/css">
.polls {
   border:2px solid #ccc;
   padding:30px 0 30px 30px;
   width:600px;
}
.rating {
   float:left;
   width:100px;
   background:transparent url(/content/img/ajax/poll-bottom.png) no-repeat bottom left;
}
.graph {
   float:left;
   margin:0; padding:0;
   position:relative;
   height:434px;
}
.graph strong {
   display:block;
   position:absolute;
   background:transparent url(/content/img/ajax/poll-body.png) no-repeat 0 0;
   color:#fff;
   width:40px;
   min-height:12px;
   font-size:8px;
   bottom:11px;
}
.graph span  {
   position:absolute;
   left:8px; top:20px;
   font-size:8px;
   color:#333;
   text-shadow:0 1px #fff;
}
      </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://papermashup.com/building-an-animated-3d-poll/' target='_blank'>Building an animated 3D poll</a></p>
         <p>▼3D棒グラフをアニメーション表示</p>
<!-- CODE -->
<h2>「メインで使っているブラウザは?」のアンケート結果 - 2010/11/09時点</h2>
<div class="polls cf">
    <div class="rating">
      <div class="graph"><strong class="bar1"><span>34%</span></strong></div>
      <div class="ans">Chrome</div>
   </div>
   <div class="rating">
      <div class="graph"><strong class="bar2"><span>6%</span></strong></div>
      <div class="ans">IE</div>
   </div>
   <div class="rating">
      <div class="graph"><strong class="bar3"><span>34%</span></strong></div>
      <div class="ans">Firefox</div>
   </div>
   <div class="rating">
      <div class="graph"><strong class="bar4"><span>7%</span></strong></div>
      <div class="ans">Safari</div>
   </div>
   <div class="rating">
      <div class="graph"><strong class="bar5"><span>7%</span></strong></div>
      <div class="ans">Opera</div>
   </div>
   <div class="rating">
      <div class="graph"><strong class="bar6"><span>12%</span></strong></div>
      <div class="ans">Lunascape</div>
   </div>
</div>
<!-- / CODE -->
      </div>
   </body>
</html>