Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
better implmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dealingwith committed Feb 16, 2016
1 parent 5ae0db9 commit 6ef1aed
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions animatedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,17 @@
id.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', afterOpen);
};
}
bindKeyUp();
$(document).one('keyup', function(e) {
if (e.keyCode == 27)
close();
});
});

closeBt.click(function(event) {
event.preventDefault();
close();
});

function bindKeyUp() {
$(document).keyup(keyUpFunc);
}

function unbindKeyUp() {
$(document).unbind("keyup", keyUpFunc);
}

function keyUpFunc(e) {
if (e.keyCode == 27)
close()
}

function close() {
$('body, html').css({'overflow':'auto'});

Expand All @@ -120,9 +110,7 @@
id.removeClass(settings.animatedIn);
id.addClass(settings.animatedOut);
id.one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', afterClose);
};

unbindKeyUp();
}
}

function afterClose () {
Expand Down

0 comments on commit 6ef1aed

Please sign in to comment.