Awesome HTML5 feature that helps to set the IFrame height dynamically.
Use the following script
<script type="text/javascript" >
$(document).ready(function(){
window.setInterval(resizeParentIframe, 2000);
});
var pastHeight = 0;
function resizeParentIframe() {
var currentHeight = document.body.scrollHeight;
if (currentHeight != pastHeight){
pastHeight = currentHeight;
parent.postMessage(document.body.scrollHeight, '*');
}
}
</script>
Use the following script
<script type="text/javascript" >
$(document).ready(function(){
window.setInterval(resizeParentIframe, 2000);
});
var pastHeight = 0;
function resizeParentIframe() {
var currentHeight = document.body.scrollHeight;
if (currentHeight != pastHeight){
pastHeight = currentHeight;
parent.postMessage(document.body.scrollHeight, '*');
}
}
</script>
No comments:
Post a Comment
Please include your thoughts/suggestion to make it as a better blog. If you find it useful, Please update with your valuable comments, so that others can use it.