view iframe-resizer/example/frame.absolute.html @ 9:7300ed4c1481 draft default tip

Uploaded
author saskia-hiltemann
date Mon, 04 Sep 2017 10:49:00 -0400
parents ac5f9272033b
children
line wrap: on
line source

<!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; }
			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;
			}
		</style>
	</head> 
	<body> 

		<p>
			<b>iFrame</b>
			<a href="frame.content.html" class="back">Back to page 1</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="http://caniuse.com/mutationobserver">caniuse.com</a> for details).</i>
		</p>
		
		<div id="abs">Absolute positioned element</div>

		<script src="http://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>