effects.transfer.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * jQuery UI Effects Transfer 1.7.2
  3. *
  4. * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI/Effects/Transfer
  9. *
  10. * Depends:
  11. * effects.core.js
  12. */
  13. (function($) {
  14. $.effects.transfer = function(o) {
  15. return this.queue(function() {
  16. var elem = $(this),
  17. target = $(o.options.to),
  18. endPosition = target.offset(),
  19. animation = {
  20. top: endPosition.top,
  21. left: endPosition.left,
  22. height: target.innerHeight(),
  23. width: target.innerWidth()
  24. },
  25. startPosition = elem.offset(),
  26. transfer = $('<div class="ui-effects-transfer"></div>')
  27. .appendTo(document.body)
  28. .addClass(o.options.className)
  29. .css({
  30. top: startPosition.top,
  31. left: startPosition.left,
  32. height: elem.innerHeight(),
  33. width: elem.innerWidth(),
  34. position: 'absolute'
  35. })
  36. .animate(animation, o.duration, o.options.easing, function() {
  37. transfer.remove();
  38. (o.callback && o.callback.apply(elem[0], arguments));
  39. elem.dequeue();
  40. });
  41. });
  42. };
  43. })(jQuery);