annotate iframe-resizer/example/index.html @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 <!DOCTYPE html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 <html>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3 <head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 <meta charset="utf-8">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 <title>iFrame message passing test</title>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6 <meta name="description" content="iFrame message passing test">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 <meta name="viewport" content="width=device-width">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 <meta http-equiv="X-UA-Compatible" content="IE=edge">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 <script type="text/javascript">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 //MDN PolyFil for IE8 (This is not needed if you use the jQuery version)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 if (!Array.prototype.forEach){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 Array.prototype.forEach = function(fun /*, thisArg */){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 "use strict";
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14 if (this === void 0 || this === null || typeof fun !== "function") throw new TypeError();
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 var
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 t = Object(this),
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18 len = t.length >>> 0,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 thisArg = arguments.length >= 2 ? arguments[1] : void 0;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 for (var i = 0; i < len; i++)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 if (i in t)
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 fun.call(thisArg, t[i], i, t);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 };
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 </head>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 <body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 <h2>Automagically resizing iFrame</h2>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 <p>Resize window or click one of the links in the iFrame to watch it resize.</p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 <div style="margin:20px;">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 <iframe src="frame.content.html" width="100%" scrolling="no"></iframe>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34 <p id="callback">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 </p>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 <div style="margin: 8px 0;font-size:13px;">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 For details on how this works, see
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38 <a href="http://davidjbradshaw.github.io/iframe-resizer/">http://davidjbradshaw.github.io/iframe-resizer/</a>.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 </div>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 <script type="text/javascript" src="../js/iframeResizer.min.js"></script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 <script type="text/javascript">
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 iFrameResize({
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 log : true, // Enable console logging
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 enablePublicMethods : true, // Enable methods within iframe hosted page
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 resizedCallback : function(messageData){ // Callback fn when resize is received
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 $('p#callback').html(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 '<b>Frame ID:</b> ' + messageData.iframe.id +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 ' <b>Height:</b> ' + messageData.height +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 ' <b>Width:</b> ' + messageData.width +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 ' <b>Event type:</b> ' + messageData.type
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 messageCallback : function(messageData){ // Callback fn when message is received
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 $('p#callback').html(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 '<b>Frame ID:</b> ' + messageData.iframe.id +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 ' <b>Message:</b> ' + messageData.message
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 alert(messageData.message);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 closedCallback : function(id){ // Callback fn when iFrame is closed
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 $('p#callback').html(
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 '<b>IFrame (</b>' + id +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 '<b>) removed from page.</b>'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 );
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 </script>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 </body>
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 </html>