summaryrefslogtreecommitdiff
path: root/reveal.js-2.6.2/plugin/postmessage/example.html
blob: cc57a7bb1e056b491f2aa5ff59af6cf99ff96cb5 (plain)
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
34
35
36
37
38
39
<html>
	<body>

		<iframe id="reveal" src="../../index.html" style="border: 0;" 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>