Skip to content

Commit

Permalink
051 sag sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
sayanee committed Sep 25, 2013
1 parent 9c04fb2 commit 86faaf5
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 051-svg/readme.md
@@ -0,0 +1,3 @@
#051 SVG

For explanatory notes, video file, tool version and other info, please refer to the [screencast link](http://build-podcast.com/svg/)
28 changes: 28 additions & 0 deletions 051-svg/water-molecule/3d.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions 051-svg/water-molecule/covalent.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions 051-svg/water-molecule/index.html
@@ -0,0 +1,46 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>SVG</title>
<style>
body{margin: 1em auto; width: 610px;}
section {display:inline-block; vertical-align: top; margin:2em 0; }
h1 {font-family: Helvetica Neue, sans-serif; font-size: 4em; display: inline-block; vertical-align: top; margin: 0; }
.small {margin: 0 0 0 20px; height: 70px; }
.large {height: 400px;}
</style>
</head>
<body>

<h1>Water Molecule</h1>
<img src="lab.svg" class="small">

<section><img src="covalent.svg"></section>
<section class="large">
<object type="image/svg+xml" data="3d.svg" id="water"></object>
</section>

<script>
var svg = document.getElementById('water');

svg.addEventListener('load', function() {
var svgDoc = svg.contentDocument;
var oxygen = svgDoc.getElementsByTagName('circle')[2];
// console.log(oxygen);

oxygen.addEventListener('click', function() {
// console.log('clicked');
if(oxygen.getAttribute('r') == 100) {
oxygen.setAttribute('r', 95);
}
else {
oxygen.setAttribute('r', 100);
}
})
});
</script>

</body>
</html>
14 changes: 14 additions & 0 deletions 051-svg/water-molecule/lab.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions 051-svg/water-molecule/line.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 86faaf5

Please sign in to comment.