Jquery-effect-bounce

提供:Dev Guides
移動先:案内検索

jQuery効果-バウンス効果

説明

*Bounce* エフェクトは、effect()メソッドで使用できます。 これにより、要素が複数回、垂直または水平に跳ね返ります。

構文

この効果を使用するための簡単な構文は次のとおりです-

selector.effect( "bounce", {arguments}, speed );

パラメーター

ここにすべての引数の説明があります-

  • 方向-効果の方向。 「上」、「下」、「左」、「右」のいずれかです。 デフォルトは「up」です。
  • 距離-バウンスする距離。 デフォルトは20
  • * mode:*エフェクトのモード。 「表示」、「非表示」、「効果」のいずれかです。 デフォルトは「効果」です。
  • times -バウンスする時間。 デフォルトは5です。

以下は、この効果の使用法を示す簡単な例です-

<html>
   <head>
      <title>The jQuery Example</title>
      <script type = "text/javascript"
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>

      <script type = "text/javascript"
         src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
      </script>

      <script type = "text/javascript" language = "javascript">

         $(document).ready(function() {

            $("#button").click(function(){
               $(".target").effect( "bounce", {times:3}, 300 );
            });

         });

      </script>

      <style>
         p {background-color:#bca; width:200px; border:1px solid green;}
         div{ width:100px; height:100px; background:red;}
      </style>

   </head>

   <body>
      <p>Click the button</p>
      <button id = "button"> Bounce </button>

      <div class = "target">
      </div>
   </body>
</html>

これにより、次の結果が生成されます–