소스 검색

Listing 4.16: animate() with an increment.

Frederic G. MARAND 8 년 전
부모
커밋
ab2f9556fe
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      Chapter 4/04.js

+ 11 - 0
Chapter 4/04.js

@@ -33,4 +33,15 @@ $(document).ready(function () {
       $link.text('read more');
     }
   });
+
+  $('div.label').click(function () {
+    var paraWidth = $('div.speech p').outerWidth();
+    var $switcher = $(this).parent();
+    var switcherWidth = $switcher.outerWidth();
+    $switcher.animate({
+      borderWidth: '5px',
+      left: paraWidth - switcherWidth,
+      height: '+=20px'
+    }, 'slow');
+  });
 });