Revert an (incorrect) fix and host contain-element.min.js locally (which we'll update when new releases are made)

This commit is contained in:
Kevin MacMartin 2015-07-02 16:37:54 -04:00
parent 46380fbaa9
commit 3667fceb7d
2 changed files with 5 additions and 4 deletions

1
contain-element.min.js vendored Normal file
View file

@ -0,0 +1 @@
function ContainElement(e){function t(){var n=i.parentElement.offsetWidth,a=i.parentElement.offsetHeight;if(n&&a){if(l=n>a/(o*l)*s*l?n/s:a/o,i.style.width=s*l+"px",i.style.height=o*l+"px",s*l>n)switch(e.halign){case"left":i.style.left="0px";break;case"right":i.style.left=0-(s*l-n)+"px";break;default:i.style.left=0-(s*l-n)/2+"px"}else i.style.left="0px";if(o*l>a)switch(e.valign){case"top":i.style.top="0px";break;case"bottom":i.style.top=0-(o*l-a)+"px";break;default:i.style.top=0-(o*l-a)/2+"px"}else i.style.top="0px"}else window.setTimeout(t,30)}var l=1,i=document.getElementById(e.id),s=e.width||i.offsetWidth,o=e.height||i.offsetHeight;i.style.position="absolute",i.parentElement.style.overflow="hidden",-1===["relative","absolute","fixed"].indexOf(window.getComputedStyle(i.parentElement,null).getPropertyValue("position"))&&(i.parentElement.style.position="relative"),t(),this.update=t}

View file

@ -3,7 +3,7 @@
<head>
<title>Contain Element - Examples</title>
<meta charset="UTF-8">
<script src="https://raw.githubusercontent.com/WilliamsNY/contain-element/master/contain-element.min.js"></script>
<script type="text/javascript" src="contain-element.min.js"></script>
<style>
html,
body {
@ -76,7 +76,7 @@
<body>
<script>
var video = '<video id="video" autoplay muted loop><source src="http://wny.s3.amazonaws.com/videos/TheenclosureoftheNextGenerationTransitSurvey.webm" type="video/webm"><source src="http://wny.s3.amazonaws.com/videos/TheenclosureoftheNextGenerationTransitSurvey.mp4" type="video/mp4"></video>';
var demo = function(id, verticalAlign, horizontalAlign) {
var demo = function(id, valign, halign) {
var v = document.getElementById('video');
if (v !== null) v.parentNode.removeChild(v);
document.body.innerHTML += video;
@ -88,8 +88,8 @@
id: 'video',
height: '720',
width: '1280',
valign: verticalAlign,
halign, horizontalAlign
valign: valign,
halign, halign
});
window.onresize = contain.update;