diff options
author | Hakim El Hattab | 2012-11-10 17:02:12 -0500 |
---|---|---|
committer | Hakim El Hattab | 2012-11-10 17:02:12 -0500 |
commit | 42766b1bfac3409eb5ec312e57d007b749edce8b (patch) | |
tree | 856e67722b515789fb0d55cd2e89727a8d46cd54 /plugin/postmessage/iframe_example.html | |
parent | b42890d1a2db6759125a97dbab5d3b9454c4a5c8 (diff) | |
parent | a7c3543069abc7525e3d4fd7a03a82afdc8a0d63 (diff) |
Merge branch 'master' of https://github.com/sithmel/reveal.js
merge postmessage api
Diffstat (limited to 'plugin/postmessage/iframe_example.html')
-rw-r--r-- | plugin/postmessage/iframe_example.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/plugin/postmessage/iframe_example.html b/plugin/postmessage/iframe_example.html new file mode 100644 index 0000000..6e5709d --- /dev/null +++ b/plugin/postmessage/iframe_example.html @@ -0,0 +1,34 @@ +<html> +<body> + <iframe id="reveal" src="reveal.js/index.html" width="500" height="500"></iframe> +<div> +<input id="back" type="button" value="go back"/> +<input id="ahead" type="button" value="go ahead"/> +<input id="slideto" type="button" value="slideto 2-2"/> +</div> +<script> +(function (){ + var back = document.getElementById('back'), + ahead = document.getElementById('ahead'), + slideto = document.getElementById('slideto'), + reveal = window.frames[0]; + + back.addEventListener('click', function (){ + + reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*'); + },false); + + ahead.addEventListener('click', function (){ + reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*'); + },false); + + slideto.addEventListener('click', function (){ + + reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*'); + },false); + +}()); + +</script> +</body> +</html> |