fix animate effect

This commit is contained in:
afc163 2015-06-04 10:57:06 +08:00
parent d43d8db6c5
commit 8d87df2f59

View File

@ -21,9 +21,11 @@ $(function() {
});
$('.code-boxes').on('click', '.collapse', function() {
$(this).parent().parent().find('.highlight').animate({
height: 'toggle',
opacity: 'toggle'
var highlightBox = $(this).parent().parent().find('.highlight');
console.log(highlightBox.is(':visible'));
highlightBox.animate({
height: highlightBox.is(':visible') ? 'hide' : 'show',
opacity: highlightBox.is(':visible') ? 0 : 1
}, 150);
});