;(function() {
var getShadow = function(conn, parent) {
if (!conn.shadow) {
conn.shadow = jsPlumb.connect({
source:conn.source,
target:parent,
anchors:["RightMiddle", [0,0,-1,0]] // this anchor is top left corner but pointing to the left, not up and left like TopLeft does
});
}
return conn.shadow;
};
window.jsPlumbFun = {
init : function() {
// bind to the scroll event in the fieldlist uls
// and repaint.
$(".fieldlist").bind("scroll", function() {
var p = $(this).parents(".dbtable"),
ult = $(this).offset().top;
$(this).find("li").each(function(i, e) {
var o = $(e).offset(), h = $(e).height();
var shouldShow = (o.top + h) > ult; jsPlumb.select({target:$(e).attr("id")}).each(function(c) {
c.endpoints[0].setVisible(shouldShow);
var s = getShadow(c,p);
s.endpoints[0].setVisible(!shouldShow);
jsPlumb.repaintEverything();
});
});
});
// Important! This attaches all the elements jsPlumnb
// creates to the workarea div. Thus allowing
// elements from different child divs to be connected.
jsPlumb.Defaults.Container = "workarea";
jsPlumb.Defaults.PaintStyle = { strokeStyle:"gray", lineWidth:3 };
jsPlumb.Defaults.Endpoint = ["Rectangle", { width:20, height:20 }];
// Make all the dbtable divs draggable
jsPlumb.draggable(jsPlumb.getSelector(".dbtable"), {
handle: '.tableheader'
});
//...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.