I'm using the excellent JQuery UI to do a "mapping" so the user can "map" persons from one program to persons from other program.
using this simple JQuery:
$(document).ready(function() { $("div .draggable").draggable({ revert: 'valid', snap: false }); $("div .droppable").droppable({ hoverClass: 'ui-state-hover', helper: 'clone', cursor: 'move', drop: function(event, ui) { $(this) .addClass('ui-state-highlight') .find("img") .removeAttr("src") .attr("src", "_assets/img/icons/check-user-48x48.png"); $(this).droppable('disable'); $(ui.draggable) .addClass('ui-state-highlight') .find("img") .removeAttr("src") .attr("src", "_assets/img/icons/check-user-48x48.png"); $(ui.draggable).draggable('disable'); } }); $("div .droppable").bind("dblclick", function() { $(this) .removeClass('ui-state-highlight') .find("img") .removeAttr("src") .attr("src", "_assets/img/icons/user-48x48.png"); $(this).droppable('enable'); EnableSource($(this)); }); });
I get to this:
what I really wanted was (if possible) create a line between Elsa and Kjell so it makes the connection between them clear.
I can always do it with numbers inside the boxes, but I really wanted to know how to do this using the lines.
Thanks.
You can use a <hr> tag. Even in an additional <tr> after every appended <tr> .
The . position() method allows us to retrieve the current position of an element relative to the offset parent. Contrast this with . offset() , which retrieves the current position relative to the document.
Limit draggable area using 'containment' option It is simple. All you have to do is, add an option called containment to the draggable() method. The containment option has a value parent.
Current example uses:
Source
Source code in Git Repository
Demo
Page demo at JSBIN
Works on FF, IE, Chrome, Safari and Opera.
tested on:
to show you all, I just made a little demo of my accomplishment (I am a proud person today!):
Video demo
and a little image:
I'm too new to post a link but if you google "Library for simple drawing with jQuery", you may find what you're looking for. :)
link here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With