jquery.drag.js 663 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * author levi
  3. * url http://levi.cg.am
  4. */
  5. $(function() {
  6. $(document).mousemove(function(e) {
  7. if (!!this.move) {
  8. var posix = !document.move_target ? {'x': 0, 'y': 0} : document.move_target.posix,
  9. callback = document.call_down || function() {
  10. $(this.move_target).css({
  11. 'top': e.pageY - posix.y,
  12. 'left': e.pageX - posix.x
  13. });
  14. };
  15. callback.call(this, e, posix);
  16. }
  17. }).mouseup(function(e) {
  18. if (!!this.move) {
  19. var callback = document.call_up || function(){};
  20. callback.call(this, e);
  21. $.extend(this, {
  22. 'move': false,
  23. 'move_target': null,
  24. 'call_down': false,
  25. 'call_up': false
  26. });
  27. }
  28. });
  29. });