Selaa lähdekoodia

Listing 3.19: event handler namespacing.

Frederic G. MARAND 9 vuotta sitten
vanhempi
sitoutus
ed3bebd080
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      Chapter 3/03.js

+ 2 - 2
Chapter 3/03.js

@@ -11,14 +11,14 @@ $(document).ready(function () {
 $(document).ready(function () {
   'use strict';
 
-  $('#switcher').click(function(event) {
+  $('#switcher').on('click.collapse', function(event) {
     if (!$(event.target).is('button')) {
       $('#switcher button').toggleClass('hidden');
     }
   });
 
   $('#switcher-narrow, #switcher-large').click(function () {
-    $('#switcher').off('click');
+    $('#switcher').off('click.collapse');
   });
 });