Quantcast
Viewing all articles
Browse latest Browse all 28

Answer by chad steele for Resizing an iframe based on content

Here's a jQuery approach that adds the info in json via the src attribute of the iframe. Here's a demo, resize and scroll this window.. the resulting url with json looks like this... http://fiddle.jshell.net/zippyskippy/RJN3G/show/#{docHeight:5124,windowHeight:1019,scrollHeight:571}#

Here's the source code fiddle http://jsfiddle.net/zippyskippy/RJN3G/

function updateLocation(){    var loc = window.location.href;    window.location.href = loc.replace(/#{.*}#/,"") +"#{docHeight:"+$(document).height() +",windowHeight:"+$(window).height()+",scrollHeight:"+$(window).scrollTop()+"}#";};//setInterval(updateLocation,500);$(window).resize(updateLocation);$(window).scroll(updateLocation);

Viewing all articles
Browse latest Browse all 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>