Reputation: 83
if ((body).hasClass('dialog-visible')){
document.body.addEventListener("touchmove", function(e) {
e.preventDefault();
}, false);
}
I am trying to remove preventDefault(); when the dialog is closed.
Upvotes: 3
Views: 8047
Reputation: 5639
There is no 'opposite' of preventDefault(); However, you can choose nót to call it at any given time you want, by moving the if:
document.body.addEventListener("touchmove", function(e) {
if((body).hasClass('dialog-visible')){
e.preventDefault();
}
}, false);
Of course, another option is to use document.body.removeEventListener(function, false)
, but this means you will have to declare your function somewhere.
Upvotes: 2