Просмотр исходного кода

Exercise 4.3: sequential animations on disjoint data.

Frederic G. MARAND 8 лет назад
Родитель
Сommit
745e4d5d8b
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      Chapter 4/04.js

+ 12 - 1
Chapter 4/04.js

@@ -64,9 +64,20 @@ $(document).ready(function () {
   });
   $('p').eq(3).css('backgroundColor', '#ccc').hide();
 
-  $('body').fadeTo(2000, 1);
+  $('body').fadeTo('slow', 1);
 
   $('p').hover(function () {
     $(this).toggleClass('highlighted');
   });
+
+  $('h2').click(function (event) {
+    var $h2 = $(this);
+    $h2.css('position', 'relative');
+    $h2.animate({
+      opacity: '0.25',
+      left: '20px'
+    }, 'slow', 'swing', function () {
+      $('.speech').animate({'opacity': '0.5'}, 'slow');
+    });
+  });
 });