소스 검색

Listing 4.17: animate() positioning.

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

+ 3 - 1
Chapter 4/04.js

@@ -38,7 +38,9 @@ $(document).ready(function () {
     var paraWidth = $('div.speech p').outerWidth();
     var $switcher = $(this).parent();
     var switcherWidth = $switcher.outerWidth();
-    $switcher.animate({
+    $switcher.css({
+      position: 'relative'
+    }).animate({
       borderWidth: '5px',
       left: paraWidth - switcherWidth,
       height: '+=20px'