I'm playing around with Kinetic.js and I noticed that only linking my javascript at the end of the body
would work. Normally wouldn't adding javascript in the head
would work?
Here is my HTML
<!DOCTYPE html>
<html>
<head>
<title>Tictactoe</title>
<META http-equiv="Content-Script-Type" content="type">
</head>
<body>
<div id="container"></div>
<script type="text/javascript" src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.4.0.min.js"></script>
<script type="text/javascript" src="javascript.js"></script>
</body>
</html>
And here is my javascript file:
var stage = new Kinetic.Stage({
container: 'container',
width: 500,
height: 500
});
var layer = new Kinetic.Layer();
var rect = new Kinetic.Rect({
x: 239,
y: 75,
width: 150,
height: 50,
fill: 'green',
stroke: 'black',
strokeWidth: 4
});
// add the shape to the layer
layer.add(rect);
stage.add(layer);