소스 검색

Listing 3.19: event handler namespacing.

Frederic G. MARAND 9 년 전
부모
커밋
ed3bebd080
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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');
   });
 });