jquery toggle and fade in one function?
Posted
by tony noriega
on Stack Overflow
See other posts from Stack Overflow
or by tony noriega
Published on 2010-04-12T22:28:06Z
Indexed on
2010/04/12
22:33 UTC
Read the original article
Hit count: 395
I was wondering if toggle() and fadeIn() could be used in one function...
i got this to work, but it only fades in after the second click... not on first click of the toggle.
$(document).ready(function() {
$('#business-blue').hide();
$('a#biz-blue').click(function() {
$('#business-blue').toggle().fadeIn('slow');
return false;
});
// hides the slickbox on clicking the noted link
$('a#biz-blue-hide').click(function() {
$('#business-blue').hide('fast');
return false;
});
});
<a href="#" id="biz-blue">Learn More</a>
<div id="business-blue" style="border:1px soild #00ff00; background:#c6c1b8; height:600px; width:600px; margin:0 auto; position:relative;">
<p>stuff here</p>
</div>
© Stack Overflow or respective owner