-
Notifications
You must be signed in to change notification settings - Fork 11
/
sample.html
33 lines (24 loc) · 825 Bytes
/
sample.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<html>
<head>
<script src='svg.js'></script>
<script src='svg.foreignobject.js'></script>
</head>
<body onload="doit()">
<h1>Foreign Objects</h1>
<div id='canvas'></div>
<script>
var txt = "some text that is quite long. and it goes on and on. and it's pointless really. and the grammar is terrible. blah. blah. blah"
var canvas = SVG('canvas').size(1024, 550)
canvas.rect(1024, 550).attr({ fill: '#eee' })
var fobj = canvas.foreignObject(100,100).attr({id: 'fobj'})
function doit() {
fobj.appendChild("div", {id: 'mydiv', innerText: txt})
var n = fobj.getChild(0)
fobj.attr({width: 200, height: 100}).rotate(45).move(100,0)
n.style.height = '50px'
n.style.overflow = 'hidden'
n.style.border = "solid black 1px"
}
</script>
</body>
</html>