first commit
This commit is contained in:
127
iframe-resizer-master_old/example/frame.absolute.html
Executable file
127
iframe-resizer-master_old/example/frame.absolute.html
Executable file
@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<style>
|
||||
a.back {
|
||||
float: right;
|
||||
margin-left: 8px;
|
||||
}
|
||||
body {
|
||||
border: solid 1px red;
|
||||
}
|
||||
p {
|
||||
padding: 5px 212px 5px 5px;
|
||||
margin: 0 0 5px;
|
||||
}
|
||||
#abs {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 200px;
|
||||
height: 600px;
|
||||
background-color: wheat;
|
||||
}
|
||||
a.top {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
<b>iFrame</b>
|
||||
|
||||
<a href="frame.content.html" class="back">Back to page 1</a>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
class=" back"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,99999);return false;"
|
||||
>Bottom</a
|
||||
>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
class=" back"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.scrollToOffset(0,0);return false;"
|
||||
>Scroll to iFrame</a
|
||||
>
|
||||
|
||||
<a href="#test" class="back">Jump to iFrame anchor</a>
|
||||
<a href="#anchorParentTest" class="back">Jump to parent anchor</a>
|
||||
</p>
|
||||
<p>
|
||||
This page has an absolute position element that take it out side the
|
||||
normal document body, which is marked with a red border on this page. This
|
||||
prevents the normal height calculation, which is based on the body tag
|
||||
from returning the correct height. To work around this you can set the
|
||||
<b>heightCalculationMethod</b> option to use one of the other page height
|
||||
propeties.
|
||||
</p>
|
||||
<p>
|
||||
Use the dropdown to change the sizing method of the page, select the
|
||||
different sizing options to see how the effect the page. Note that they
|
||||
can have different effects in different browsers, so you are normally best
|
||||
off selecting <b>max</b> if you need to change away from the default
|
||||
<b>bodyOffset</b> option.
|
||||
</p>
|
||||
<p data-iframe-height>
|
||||
<b>Height Calculation Method</b>
|
||||
<select name="heightCalculationMethod">
|
||||
<option>bodyOffset</option>
|
||||
<option>bodyScroll</option>
|
||||
<option>documentElementOffset</option>
|
||||
<option>documentElementScroll</option>
|
||||
<option>max</option>
|
||||
<option>min</option>
|
||||
<option>grow</option>
|
||||
<option>lowestElement</option>
|
||||
<option>taggedElement</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<i
|
||||
>This option should be used sparingly, as the alternate methods can be
|
||||
less acurate at working out the correct page size, can cause screen
|
||||
flicker and can sometimes fail to reduce in size when the frame content
|
||||
changes in browsers that do not support mutationObservers (See
|
||||
<a href="https://caniuse.com/mutationobserver">caniuse.com</a> for
|
||||
details).</i
|
||||
>
|
||||
</p>
|
||||
<a name="test">Test in page anchor</a>
|
||||
|
||||
<div id="abs">
|
||||
Absolute positioned element
|
||||
<a
|
||||
href="#"
|
||||
class="top"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,0);return false;"
|
||||
>Top</a
|
||||
>
|
||||
</div>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../js/iframeResizer.contentWindow.min.js"
|
||||
></script>
|
||||
<script>
|
||||
$('select').on('change', function() {
|
||||
if ('parentIFrame' in window) {
|
||||
parentIFrame.setHeightCalculationMethod($(this).val())
|
||||
parentIFrame.size()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
113
iframe-resizer-master_old/example/frame.content.html
Executable file
113
iframe-resizer-master_old/example/frame.content.html
Executable file
@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<style>
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-model: border-box;
|
||||
}
|
||||
a {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<b>iFrame</b>
|
||||
<a href="#" onclick="$('p:eq(0)').toggle();return false;">Toggle content</a>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.size(250);return false;"
|
||||
>Size(250)</a
|
||||
>
|
||||
|
||||
<a id="nested" href="frame.nested.html">Nested</a>
|
||||
|
||||
<a href="frame.hover.html">:Hover</a>
|
||||
|
||||
<a href="frame.textarea.html">TextArea</a>
|
||||
|
||||
<a href="frame.absolute.html">Absolute Position</a>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.sendMessage('Hello from the iFrame');return false;"
|
||||
>Send Message</a
|
||||
>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.close();return false;"
|
||||
>Close</a
|
||||
>
|
||||
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
||||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
||||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
|
||||
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
|
||||
est laborum.
|
||||
</p>
|
||||
<p>
|
||||
But I must explain to you how all this mistaken idea of denouncing
|
||||
pleasure and praising pain was born and I will give you a complete account
|
||||
of the system, and expound the actual teachings of the great explorer of
|
||||
the truth, the master-builder of human happiness. No one rejects,
|
||||
dislikes, or avoids pleasure itself, because it is pleasure, but because
|
||||
those who do not know how to pursue pleasure rationally encounter
|
||||
consequences that are extremely painful. Nor again is there anyone who
|
||||
loves or pursues or desires to obtain pain of itself, because it is pain,
|
||||
but because occasionally circumstances occur in which toil and pain can
|
||||
procure him some great pleasure. To take a trivial example, which of us
|
||||
ever undertakes laborious physical exercise, except to obtain some
|
||||
advantage from it? But who has any right to find fault with a man who
|
||||
chooses to enjoy a pleasure that has no annoying consequences, or one who
|
||||
avoids a pain that produces no resultant pleasure?
|
||||
</p>
|
||||
<p>
|
||||
On the other hand, we denounce with righteous indignation and dislike men
|
||||
who are so beguiled and demoralized by the charms of pleasure of the
|
||||
moment, so blinded by desire, that they cannot foresee the pain and
|
||||
trouble that are bound to ensue; and equal blame belongs to those who fail
|
||||
in their duty through weakness of will, which is the same as saying
|
||||
through shrinking from toil and pain. These cases are perfectly simple and
|
||||
easy to distinguish. In a free hour, when our power of choice is
|
||||
untrammelled and when nothing prevents our being able to do what we like
|
||||
best, every pleasure is to be welcomed and every pain avoided. But in
|
||||
certain circumstances and owing to the claims of duty or the obligations
|
||||
of business it will frequently occur that pleasures have to be repudiated
|
||||
and annoyances accepted. The wise man therefore always holds in these
|
||||
matters to this principle of selection: he rejects pleasures to secure
|
||||
other greater pleasures, or else he endures pains to avoid worse pains.
|
||||
</p>
|
||||
|
||||
<script>
|
||||
var level = document.location.search.replace(/\?/, '') || 0
|
||||
$('#nested').attr('href', 'frame.nested.html?' + ++level)
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var iFrameResizer = {
|
||||
onMessage: function(message) {
|
||||
alert(message, parentIFrame.getId())
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../js/iframeResizer.contentWindow.min.js"
|
||||
defer
|
||||
></script>
|
||||
</body>
|
||||
</html>
|
68
iframe-resizer-master_old/example/frame.hover.html
Executable file
68
iframe-resizer-master_old/example/frame.hover.html
Executable file
@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<style>
|
||||
a {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<b>iFrame :Hover Example</b>
|
||||
<a href="frame.content.html">Back to page 1</a>
|
||||
|
||||
<p>
|
||||
Mouse over the code example below.
|
||||
</p>
|
||||
|
||||
<xmp>
|
||||
<!-- #code -->
|
||||
</xmp>
|
||||
|
||||
<script>
|
||||
var iFrameResizer = {
|
||||
heightCalculationMethod: 'lowestElement'
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../js/iframeResizer.contentWindow.min.js"
|
||||
></script>
|
||||
|
||||
<div id="code">
|
||||
<style>
|
||||
xmp {
|
||||
background-color: #eee;
|
||||
padding: 20px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
xmp:hover {
|
||||
border: #c33 solid 40px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
;(function() {
|
||||
$('xmp').hover(function() {
|
||||
if ('parentIFrame' in window) {
|
||||
// Fix race condition in FireFox with setTimeout
|
||||
setTimeout(parentIFrame.size.bind(parentIFrame), 0)
|
||||
}
|
||||
})
|
||||
})()
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('xmp').text('<xmp>' + $('#code').html() + '<xmp>')
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
100
iframe-resizer-master_old/example/frame.nested.html
Executable file
100
iframe-resizer-master_old/example/frame.nested.html
Executable file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<style>
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-model: border-box;
|
||||
}
|
||||
a {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
}
|
||||
body {
|
||||
margin: 8px !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="frame.content.html">Back to page 1</a>
|
||||
<h2>Nested iFrame</h2>
|
||||
<p>
|
||||
Resize window or click one of the links in the nested iFrame to watch it
|
||||
resize.
|
||||
</p>
|
||||
<div style="margin:20px;">
|
||||
<iframe
|
||||
id="nestedIFrame"
|
||||
src="frame.content.html"
|
||||
width="100%"
|
||||
scrolling="no"
|
||||
></iframe>
|
||||
</div>
|
||||
<p id="callback"></p>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../js/iframeResizer.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
var level = document.location.search.replace(/\?/, '') || 0
|
||||
|
||||
$('iframe')
|
||||
.attr('id', 'nestedIFrame' + level)
|
||||
.attr('src', 'frame.content.html?' + level)
|
||||
|
||||
/*
|
||||
* If you do not understand what the code below does, then please just use the
|
||||
* following call in your own code.
|
||||
*
|
||||
* iFrameResize({log:true});
|
||||
*
|
||||
* Once you have it working, set the log option to false.
|
||||
*/
|
||||
|
||||
iFrameResize({
|
||||
log: true, // Enable console logging
|
||||
inPageLinks: true,
|
||||
onResized: function(messageData) {
|
||||
// Callback fn when message is received
|
||||
$('p#callback').html(
|
||||
'<b>Frame ID:</b> ' +
|
||||
messageData.iframe.id +
|
||||
' <b>Height:</b> ' +
|
||||
messageData.height +
|
||||
' <b>Width:</b> ' +
|
||||
messageData.width +
|
||||
' <b>Event type:</b> ' +
|
||||
messageData.type
|
||||
)
|
||||
},
|
||||
onMessage: function(messageData) {
|
||||
// Callback fn when message is received
|
||||
parentIFrame.sendMessage(
|
||||
messageData.message + ' (via ' + $('iframe').attr('id') + ')'
|
||||
)
|
||||
},
|
||||
onClosed: function(id) {
|
||||
/// Callback fn when iFrame is closed
|
||||
$('p#callback').html(
|
||||
'<b>IFrame (</b>' + id + '<b>) removed from page.</b>'
|
||||
)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../js/iframeResizer.contentWindow.min.js"
|
||||
></script>
|
||||
</body>
|
||||
</html>
|
45
iframe-resizer-master_old/example/frame.textarea.html
Executable file
45
iframe-resizer-master_old/example/frame.textarea.html
Executable file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<style>
|
||||
a {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<b>iFrame TextArea Example</b>
|
||||
<a href="frame.content.html">Back to page 1</a>
|
||||
|
||||
<p>
|
||||
Resize the textarea below.
|
||||
</p>
|
||||
|
||||
<textarea id="textArea">Resize me</textarea>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script src="../js/iframeResizer.contentWindow.min.js"></script>
|
||||
|
||||
<script>
|
||||
function store() {
|
||||
this.x = this.offsetWidth
|
||||
this.y = this.offsetHeight
|
||||
}
|
||||
|
||||
$('textarea')
|
||||
.each(store)
|
||||
.on('mouseover mouseout', function() {
|
||||
if (this.offsetWidth !== this.x || this.offsetHeight !== this.y) {
|
||||
if ('parentIFrame' in window) parentIFrame.size()
|
||||
store.call(this)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
113
iframe-resizer-master_old/example/frame.tolerance.html
Executable file
113
iframe-resizer-master_old/example/frame.tolerance.html
Executable file
@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<style>
|
||||
a.back {
|
||||
float: right;
|
||||
margin-left: 8px;
|
||||
}
|
||||
body {
|
||||
border: solid 1px red;
|
||||
}
|
||||
p {
|
||||
padding: 5px 212px 5px 5px;
|
||||
margin: 0 0 5px;
|
||||
}
|
||||
#abs {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: -10;
|
||||
pxright: 0;
|
||||
width: 200px;
|
||||
height: 101%;
|
||||
background-color: wheat;
|
||||
}
|
||||
a.top {
|
||||
position: absolute;
|
||||
bottom: -10px;
|
||||
right: 0;
|
||||
margin: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>
|
||||
<b>iFrame</b>
|
||||
|
||||
<a href="frame.content.html" class="back">Back to page 1</a>
|
||||
|
||||
<a
|
||||
href="#"
|
||||
class="back"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,99999999);return false;"
|
||||
>Bottom</a
|
||||
>
|
||||
</p>
|
||||
<p>
|
||||
This page has an absolute position elemnt that take it out side the normal
|
||||
document body, which is marked with a red border on this page. This
|
||||
prevents the normal height calculation, which is based on the body tag
|
||||
from returning the correct height. To work around this you can set the
|
||||
<b>heightCalculationMethod</b> option to use one of the other page height
|
||||
propeties.
|
||||
</p>
|
||||
<p>
|
||||
Use the dropdown to change the sizing method of the page, select the
|
||||
different sizing options to see how the effect the page. Note that they
|
||||
can have different effects in different browsers, so you are normally best
|
||||
off selecting <b>max</b> if you need to change away from the default
|
||||
<b>bodyOffset</b> option.
|
||||
</p>
|
||||
<p>
|
||||
<b>Height Calculation Method</b>
|
||||
<select name="heightCalculationMethod">
|
||||
<option>bodyOffset</option>
|
||||
<option>bodyScroll</option>
|
||||
<option>documentElementOffset</option>
|
||||
<option>documentElementScroll</option>
|
||||
<option>max</option>
|
||||
<option>min</option>
|
||||
<option>grow</option>
|
||||
<option>lowestElement</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<i
|
||||
>This option should be used sparingly, as the alternate methods can be
|
||||
less acurate at working out the correct page size, can cause screen
|
||||
flicker and can sometimes fail to reduce in size when the frame content
|
||||
changes in browsers that do not support mutationObservers (See
|
||||
<a href="https://caniuse.com/mutationobserver">caniuse.com</a> for
|
||||
details).</i
|
||||
>
|
||||
</p>
|
||||
|
||||
<div id="abs">
|
||||
Absolute positioned element
|
||||
<a
|
||||
href="#"
|
||||
class="top"
|
||||
onclick="if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,0);return false;"
|
||||
>Top</a
|
||||
>
|
||||
</div>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../js/iframeResizer.contentWindow.min.js"
|
||||
></script>
|
||||
<script>
|
||||
$('select').on('change', function() {
|
||||
if ('parentIFrame' in window) {
|
||||
parentIFrame.setHeightCalculationMethod($(this).val())
|
||||
parentIFrame.size()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
83
iframe-resizer-master_old/example/index.html
Executable file
83
iframe-resizer-master_old/example/index.html
Executable file
@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Automagically resizing iFrame</h2>
|
||||
<p>
|
||||
Resize window or click one of the links in the iFrame to watch it resize.
|
||||
Or try with <a name="anchorParentTest" href="two.html">two iFrames</a>.
|
||||
</p>
|
||||
<div style="margin:20px;">
|
||||
<iframe src="frame.content.html" width="100%" scrolling="no"></iframe>
|
||||
</div>
|
||||
<p id="callback"></p>
|
||||
<div style="margin: 8px 0;font-size:13px;">
|
||||
For details on how this works, see
|
||||
<a href="https://davidjbradshaw.github.io/iframe-resizer/"
|
||||
>https://davidjbradshaw.github.io/iframe-resizer/</a
|
||||
>.
|
||||
</div>
|
||||
|
||||
<!-- MDN PolyFils for IE8 (This is not normally needed if you use the jQuery version) -->
|
||||
<!--[if lte IE 8]>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../js/iframeResizer.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* If you do not understand what the code below does, then please just use the
|
||||
* following call in your own code.
|
||||
*
|
||||
* iFrameResize({log:true});
|
||||
*
|
||||
* Once you have it working, set the log option to false.
|
||||
*/
|
||||
|
||||
iFrameResize({
|
||||
log: true, // Enable console logging
|
||||
inPageLinks: true,
|
||||
onResized: function(messageData) {
|
||||
// Callback fn when resize is received
|
||||
$('p#callback').html(
|
||||
'<b>Frame ID:</b> ' +
|
||||
messageData.iframe.id +
|
||||
' <b>Height:</b> ' +
|
||||
messageData.height +
|
||||
' <b>Width:</b> ' +
|
||||
messageData.width +
|
||||
' <b>Event type:</b> ' +
|
||||
messageData.type
|
||||
)
|
||||
},
|
||||
onMessage: function(messageData) {
|
||||
// Callback fn when message is received
|
||||
$('p#callback').html(
|
||||
'<b>Frame ID:</b> ' +
|
||||
messageData.iframe.id +
|
||||
' <b>Message:</b> ' +
|
||||
messageData.message
|
||||
)
|
||||
alert(messageData.message)
|
||||
document
|
||||
.getElementsByTagName('iframe')[0]
|
||||
.iFrameResizer.sendMessage('Hello back from parent page')
|
||||
},
|
||||
onClosed: function(id) {
|
||||
// Callback fn when iFrame is closed
|
||||
$('p#callback').html(
|
||||
'<b>IFrame (</b>' + id + '<b>) removed from page.</b>'
|
||||
)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
88
iframe-resizer-master_old/example/two.html
Executable file
88
iframe-resizer-master_old/example/two.html
Executable file
@ -0,0 +1,88 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>iFrame message passing test</title>
|
||||
<meta name="description" content="iFrame message passing test" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>Automagically resizing iFrame</h2>
|
||||
<p>
|
||||
Resize window or click one of the links in the iFrame to watch it resize.
|
||||
Or go back to a
|
||||
<a name="anchorParentTest" href="index.html">single iFrame</a>.
|
||||
</p>
|
||||
<div style="margin:20px;">
|
||||
<iframe
|
||||
src="frame.content.html"
|
||||
width="48%"
|
||||
scrolling="no"
|
||||
style="float:left;margin-right:2%"
|
||||
></iframe>
|
||||
<iframe src="frame.content.html" width="48%" scrolling="no"></iframe>
|
||||
</div>
|
||||
<p id="callback"></p>
|
||||
<div style="margin: 8px 0;font-size:13px;">
|
||||
For details on how this works, see
|
||||
<a href="https://davidjbradshaw.github.io/iframe-resizer/"
|
||||
>https://davidjbradshaw.github.io/iframe-resizer/</a
|
||||
>.
|
||||
</div>
|
||||
|
||||
<!-- MDN PolyFils for IE8 -->
|
||||
<!--[if lte IE 8]>
|
||||
|
||||
<![endif]-->
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../src/iframeResizer.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* If you do not understand what the code below does, then please just use the
|
||||
* following call in your own code.
|
||||
*
|
||||
* iFrameResize({log:true});
|
||||
*
|
||||
* Once you have it working, set the log option to false.
|
||||
*/
|
||||
|
||||
iFrameResize({
|
||||
log: true, // Enable console logging
|
||||
enablePublicMethods: true, // Enable methods within iframe hosted page
|
||||
enableInPageLinks: true,
|
||||
onResized: function(messageData) {
|
||||
// Callback fn when resize is received
|
||||
$('p#callback').html(
|
||||
'<b>Frame ID:</b> ' +
|
||||
messageData.iframe.id +
|
||||
' <b>Height:</b> ' +
|
||||
messageData.height +
|
||||
' <b>Width:</b> ' +
|
||||
messageData.width +
|
||||
' <b>Event type:</b> ' +
|
||||
messageData.type
|
||||
)
|
||||
},
|
||||
onMessage: function(messageData) {
|
||||
// Callback fn when message is received
|
||||
$('p#callback').html(
|
||||
'<b>Frame ID:</b> ' +
|
||||
messageData.iframe.id +
|
||||
' <b>Message:</b> ' +
|
||||
messageData.message
|
||||
)
|
||||
alert(messageData.message + ' (' + messageData.iframe.id + ')')
|
||||
},
|
||||
onClosed: function(id) {
|
||||
// Callback fn when iFrame is closed
|
||||
$('p#callback').html(
|
||||
'<b>IFrame (</b>' + id + '<b>) removed from page.</b>'
|
||||
)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user