Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <div class="button">Click Me</div>
  2.  
  3. <div class="to_change"></div>
  4.  
  5. $(function(){
  6.  
  7. var button = $('.button')
  8. var to_change = $('.to_change');
  9.  
  10. $(window).on('custom_trigger', function(){
  11. button.trigger('click');
  12. })
  13.  
  14. //when the button is clicked, run the animation
  15. button.click(function(){
  16.  
  17. to_change.html('new div text')
  18. .fadeIn({duration: 2000, queue: 'performance'})
  19. .delay(5000, 'performance')
  20. .fadeOut({duration: 2000, queue: 'performance'})
  21. .queue('performance', function(next){
  22. console.log('performance done');
  23. $(window).trigger('custom_trigger');
  24. next();
  25. })
  26. .dequeue('performance')
  27.  
  28. })
  29. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement