Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. $( ".box-handle" ).draggable({
  2. containment: ".container",
  3. scroll: false,
  4. drag: function () { /* While dragging check for stuff */
  5.  
  6. var box = $(this);
  7. var boxPosition = box.position();
  8. box.find('.arrow').show();
  9.  
  10. if (boxPosition.left >= 90)
  11. {
  12. // In the parent div called ".box" find ".box-line"
  13. box.closest('.box').find('.box-line').css({
  14. 'top':'50px', /* Put top left corner of ".box-line" a the edge of ".static" */
  15. 'left':'110px',
  16. 'width': boxPosition.left - 60, /* Put bottom right corner of ".box-line" a the edge of current dragged box */
  17. 'height': boxPosition.top + 50,
  18. 'border':'none',
  19. 'border-top':'1px solid #bfbfbf',
  20. 'border-right':'1px solid #bfbfbf'
  21. });
  22. /* place the arrow*/
  23. box.find('.arrow').css({
  24. 'top':'-10px',
  25. 'left':'45px'
  26. });
  27. }
  28. else if (boxPosition.left < 90)
  29. {
  30. box.closest('.box').find('.box-line').css({
  31. 'top':'110px',
  32. 'left':'50px',
  33. 'width': boxPosition.left,
  34. 'height': boxPosition.top - 60,
  35. 'border':'none',
  36. 'border-left':'1px solid #bfbfbf',
  37. 'border-bottom':'1px solid #bfbfbf'
  38. });
  39. box.find('.arrow').css({
  40. 'top':'45px',
  41. 'left':'-10px'
  42. });
  43. }
  44. }
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement