Created
April 14, 2017 19:18
-
-
Save 0632347878/d5f8712c718860f6d31477d3802af8d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var box = $('#box'); | |
$('button').on('click', function () { | |
if (box.hasClass('hidden')) { | |
box.removeClass('hidden'); | |
setTimeout(function () { | |
box.removeClass('visuallyhidden'); | |
}, 20); | |
} else { | |
box.addClass('visuallyhidden'); | |
box.one('transitionend', function(e) { | |
box.addClass('hidden'); | |
}); | |
} | |
}); | |
.hidden { | |
display: none; | |
} | |
.visuallyhidden { | |
opacity: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment