-
-
Save klaascuvelier/1769719 to your computer and use it in GitHub Desktop.
Responsive design tester - Fork of Lenscos gist for reponsive design tester (https://gist.github.com/1685127) added allow-scripts and update all frame locations when one of the frames location changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Responsive Design Testing</title> | |
<style> | |
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; } | |
.wrapper { width: 6000px; } | |
.frame { float: left; } | |
h2 { margin: 0 0 5px 0; } | |
iframe { margin: 0 20px 20px 0; border: 1px solid #666; } | |
</style> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<div class="frame"> | |
<h2>320 × 480 <small>(mobile)</small></h2> | |
<iframe src="./" sandbox="allow-same-origin allow-forms allow-scripts" seamless width="320" height="480"></iframe> | |
</div> | |
<div class="frame"> | |
<h2>480 × 640 <small>(small tablet)</small></h2> | |
<iframe src="./" sandbox="allow-same-origin allow-forms allow-scripts" seamless width="480" height="640"></iframe> | |
</div> | |
<div class="frame"> | |
<h2>768 × 1024 <small>(tablet - portrait)</small></h2> | |
<iframe src="./" sandbox="allow-same-origin allow-forms allow-scripts" seamless width="768" height="1024"></iframe> | |
</div> | |
<div class="frame"> | |
<h2>1024 × 768 <small>(tablet - landscape)</small></h2> | |
<iframe src="./" sandbox="allow-same-origin allow-forms allow-scripts" seamless width="1024" height="768"></iframe> | |
</div> | |
<div class="frame"> | |
<h2>1200 × 800 <small>(desktop)</small></h2> | |
<iframe src="./" sandbox="allow-same-origin allow-forms allow-scripts" seamless width="1200" height="800"></iframe> | |
</div> | |
</div> | |
<script> | |
/** | |
* This script makes sure you have the same page open in each frame, | |
* if you click a link in one frame, the other frames locations will | |
* be updated too | |
* */ | |
var frames = document.getElementsByTagName('iframe'), | |
count = frames.length, | |
i; | |
for (i = 0; i < count; i++) { | |
var frame = frames[i]; | |
frames[i].onload = (function (sender, frames, count) { | |
return function () { | |
for (i = 0; i < count; i++) { | |
var frame = frames[i]; | |
if (sender.contentWindow.location.href !== frame.contentWindow.location.href) | |
{ | |
frame.contentWindow.location.href = sender.contentWindow.location.href; | |
} | |
} | |
} | |
})(frame, frames, count); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment