Fade Callback on Elements
In the following example, both fade events start at the same time. Seems to do with the first fade event including the 2nd.
Example (click 'go'):
go
foo
bar
Code:
- <script type="text/javascript">
- function foobar(){
- $('.foo').fadeOut(800, function(){
- $('#bar').fadeIn(800);
- });
- }
- $(function(){
- $('#bar').hide();
- $('#go').bind('click',function(){foobar();});
- });
- </script>
- <div id="go">go</div>
- <div class="foo">foo</div>
- <div id="bar" class="foo">bar</div>