Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. simple jQuery Chaining insight
  2. $(this).parent().fadeOut(500).remove();
  3.        
  4. $(this).parent().fadeOut(500,function() { $(this).remove(); });
  5.        
  6. $.fn.fxRemove = function() {
  7.     this.queue(function(next) {
  8.         $(this).remove();
  9.         next();
  10.     });
  11.     return(this);
  12. }
  13.        
  14. $(this).parent().fadeOut(500).fxRemove();
  15.        
  16. $.fn.q = function(fn) {
  17.     var that = this, arg = Array.prototype.slice.call(arguments, 1);
  18.  
  19.     return this.queue(function(next) {
  20.         that[fn].apply(that, arg);
  21.         next();
  22.     });
  23. };
  24.        
  25. $(this).parent().fadeOut(500).q('remove');
  26.        
  27. $(this).parent().fadeOut().delay(500).remove();