demo-json.html: Separate code from data

This commit is contained in:
anatoly techtonik 2013-03-12 16:38:12 +03:00
parent 1e6b1ad035
commit 64db6c14bc

View File

@ -3,10 +3,10 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="springy.js"></script>
<script src="springyui.js"></script>
<script>
var graph = new Graph();
graph.loadJSON(
{
var graphJSON = {
"nodes": [
'Amphitryon',
'Alcmene',
@ -19,10 +19,12 @@ graph.loadJSON(
['Amphitryon', 'Iphicles'],
['Amphitryon', 'Heracles']
]
}
);
};
jQuery(function(){
var graph = new Graph();
graph.loadJSON(graphJSON);
var springy = jQuery('#springydemo').springy({
graph: graph
});
@ -30,5 +32,7 @@ jQuery(function(){
</script>
<canvas id="springydemo" width="640" height="480" />
</body>
</html>