I'll try explain what I want to do. I have a resize function which runs when I press a button. This function opens two columns out of window and leave it out when the window is resized. However, I would like to reset that handler when I click on another div later. Just remove or clear that function from memory to avoid the resize. I have read some posts but any of them solve my problem.
My function to resize is:
function resizeColumnsOut(){
$(window).resize(function() {
var widthLeft = $('.column-left').outerWidth()+100,
widthRight = $('.column-right').outerWidth()+100,
vph = $(window).height();
$('.options').css({'height': vph + 'px', 'overflow': 'hidden'});
$('.column-left').css(
{'transform': 'translateX(-'+widthLeft+'px)',
'transition': 'all ease-out .6s'});
$('.column-right').css(
{'transform': 'translateX('+widthRight+'px)',
'transition': 'all ease-out .6s'});
}).resize();
}
$('[data-menu="close"]').click(function(){
$(this).hide();
resizeColumnsOut();
});
My function to reset the previous function when I click on:
function goAbout(){
$('.about').click(function(){
/* Events like .off() or .unbind() don't solve my problem since the resizeColumnsOut() function is already running */
}
.off()is the way to go. If you mean that the animation is still running, after doing.off()you need to settransform:none !importantandtransitionwith.css().