Frederic G. MARAND 9 лет назад
Родитель
Сommit
c489dab013
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      Chapter 3/03.js

+ 4 - 2
Chapter 3/03.js

@@ -5,8 +5,10 @@ $(document).ready(function () {
     .hover(
       function () { $(this).addClass('hover'); },
       function () { $(this).removeClass('hover'); })
-    .click(function () {
-      $('#switcher button').toggleClass('hidden');
+    .click(function (event) {
+      if (event.target === this) {
+        $('#switcher button').toggleClass('hidden');
+      }
     });
 
     $('#switcher-default').addClass('selected');