Created
August 12, 2015 12:50
-
-
Save atsea/6b606b9cfb4f8cd3dd41 to your computer and use it in GitHub Desktop.
jQuery: animate opacity on slideToggle
This file contains hidden or 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
/** | |
* UDBrand header | |
* http://stackoverflow.com/questions/21918477/jquery-toggle-opacity-on-click-using-css-animation | |
* http://stackoverflow.com/questions/18995647/jquery-make-global-variable | |
*/ | |
var current_width; | |
var pixel_ratio; | |
var logo_big; | |
$('#searchdiv').on('click', function(e){ | |
$('.dropDown').slideToggle(300); | |
if ( current_width < 768) { | |
logo_big = $('#ud_primary_logo_big'); | |
// logo_big is not visible lets make it visible. | |
if(logo_big.css('opacity') === '0') { | |
logo_big.animate({ | |
opacity: '1', | |
width: '177px' | |
}); | |
} | |
else { | |
logo_big.animate({ | |
opacity: '0', | |
width: '0' | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment