HOME > > > > >

:animated

戻り値

jQuery

アニメーションしている要素だけを取得。box2はアニメーション中に選択されればborderが太くなる。

サンプル

実行結果

box1
box2
box3

Javascript

  1. $('.jqTest div').each(function(i){
  2.      $(this).css({
  3.          width: 80,
  4.          height: 80,
  5.          border: '1px solid #555555',
  6.          backgroundColor: '#EEFFFF',
  7.          display: 'inline-block',
  8.          margin: 10
  9.      });
  10. });
  11.  
  12. var ani = {};
  13. ani.f1 = function() {
  14.         $('.box1').slideToggle('slow', ani.f1);
  15. }
  16. ani.f1();
  17.  
  18. $('.btn2').click(function(){
  19.         $('.box2').toggle('slow');
  20. });
  21.  
  22. $('.btn3').click(function(){
  23.         $(':animated', '.jqTest').css({ border: '5px solid #990000' });
  24. });

HTML

  1. <button class="btn2">box2 run</button>
  2. <button class="btn3">select :animated</button>
  3. <div class="jqTest">
  4.      <div class="box1">box1</div>
  5.      <div class="box2">box2</div>
  6.      <div class="box3">box3</div>
  7. </div>
参照ページ