javascript - JointJS: Hello World example doesn't work -
I am always looking at this exception when I try Hello World from the UN site:
UnkType type error: Can not code call 'getStrokeBBox' undefined
:
& Lt; Script src = "js / joint.js" & gt; & Lt; / Script & gt; - & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "http://www.jointjs.com/downloads/joint.css" & gt; & Lt; / Link> & Lt; Script type = "text / javascript" src = "http://www.jointjs.com/downloads/joint.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Var graph = new joint. Dia.Graph; Var Paper = New Combined Dia.Paper ({AL: $ ('#holder'), width: 600, height: 200, model: graph}); Var rect = new joint.shapes.basic.Rect ({position: {x: 100, y: 30}, Size: {width: 100, height: 30}, attrs: {rect: {fill: 'blue'}, Text: {text: 'my box', fill out: 'white'}}}); Var rect2 = rect.clone (); Rect2.translate (300); Var link = new joint.dia.Link ({source: {id: rect.id}, target: {id: rect2.id}}); Graph.addCells ([rect, rect2, link]); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Title & gt; Test & lt; / Title & gt; & Lt; Body & gt; & Lt; Div id = "myholder" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; I have seen that another question has already been asked for the same problem, but the solutions given there are not relevant because I have a div element for the paper object.
el: $ ('# myholder'),
Read Browsers from top to bottom. The browser is executing this line before finding an element with the ID of myholder
, so L
is an empty jQuery object.
Instead, move your script tag below the HTML (before the browser has tried to catch it or found the myholder
) or wrap it in all.
Comments
Post a Comment