Reputation: 8095
$('.filter-tab').on('click', function(){
var $correspondingOverlay = $(this).next().next();
$correspondingOverlay.fadeIn();
if($('#one').is(':visible')) {
$('#sort h2').off('click');
}
if($('#two').is(':visible')) {
$('#filter h2').off('click');
}
});
$('.close').on('click', function () {
$('.filter-results').fadeOut();
$('#filter h2, #sort h2').on('click');
});
The off() part doesnt take of the click and still allows correpsoding overlay to fade in. Any ideas where I'm going wrong here?
Upvotes: 0
Views: 35
Reputation: 2948
The off should have the same selector as the on.
Therefore this should work:
$('.filter-tab').off('click');
Else you must have multiple different .on's with less generic selector.
Upvotes: 1