Explorar o código

Listing 4.16: animate() with an increment.

Frederic G. MARAND %!s(int64=8) %!d(string=hai) anos
pai
achega
ab2f9556fe
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  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');
+  });
 });