2013-12-12 3 views
0

내가 가진 :스크립트 실행 중지 중?

$('body.fb-not-liked') 

을 클릭하면 는

$('body.fb-not-liked').on('click', function(){ 

     $('#like-to-enter-btn').animate({top:'5'}, 200, 'swing'); 
     $('#like-to-enter-btn').animate({top:'20'}, 200, 'swing'); 

     return false; 

    }); 

$('.col:not(.disabled)').on('click', function(){ 
     $('#modal').animate({top:'40'}, 300, 'swing'); 
     $('#overlay').fadeIn(); 
    }); 

어떻게 그것은 있도록 할 수 있습니다

, 방법

$('.col:not(.disabled)').on('click', function(){ 

가 발생하지 않습니다?

+2

Can 마크 업도 게시 하시겠습니까? – sachinjain024

+0

@blunderboy : 정말로 마크 업이 필요합니까? – TheCarver

+0

@PaparazzoKid 몸체를 클릭하면 클래스 col을 갖는 요소를 클릭하고 사용할 수 없게되는 것을 클릭하는 방법이 코드에서 명확하지 않습니다. 그러나, Otherway는 사실 일 수 있습니다. col을 클릭하면 몸체를 클릭 할 수 있습니다. – sachinjain024

답변

0

놓습니다 .col에 클래스 (예 : "아니오 클릭") ($('body.fb-not-liked')을 클릭하면)와 .col에 클릭에서 해당 클래스를 제외 :

예 :

$('.col:not(.disabled):not(.no-click)').on('click', function(){ 
0

어쩌면 .off()을 사용하고 주변 이벤트를 스왑하는 것 :

$('.col:not(.disabled)').on('click', function(){ 
     $('#modal').animate({top:'40'}, 300, 'swing'); 
     $('#overlay').fadeIn(); 
}); 

$('body.fb-not-liked').on('click', function() { 
     $('.col:not(.disabled)').off('click'); // <----- this here 
     $('#like-to-enter-btn').animate({top:'5'}, 200, 'swing'); 
     $('#like-to-enter-btn').animate({top:'20'}, 200, 'swing'); 
     return false; 
}); 
+0

'unbind' 대신'off'를 사용하십시오. – Satpal

+1

@Satpal 처음에는 다른 하나라고 생각했지만 당신 말이 맞습니다. 감사. – TheCarver

관련 문제