mirror of
https://github.com/WilliamsNY/contain-element.git
synced 2024-11-23 22:24:10 -05:00
Update minified library
This commit is contained in:
parent
82e8f01a65
commit
59fb1bf541
1 changed files with 1 additions and 1 deletions
2
contain-element.min.js
vendored
2
contain-element.min.js
vendored
|
@ -1 +1 @@
|
||||||
function containElement(e){function t(){var s=i.parentElement.offsetWidth,a=i.parentElement.offsetHeight;if(s&&a){if(n=s>a/(o*n)*l*n?s/l:a/o,i.style.width=l*n+"px",i.style.height=o*n+"px",l*n>s)switch(e.halign){case"left":i.style.left="0px";break;case"right":i.style.left=0-(l*n-s)+"px";break;default:i.style.left=0-(l*n-s)/2+"px"}else i.style.left="0px";if(o*n>a)switch(e.valign){case"top":i.style.top="0px";break;case"bottom":i.style.top=0-(o*n-a)+"px";break;default:i.style.top=0-(o*n-a)/2+"px"}else i.style.top="0px"}else window.setTimeout(t,30)}var n=1,i=document.getElementById(e.id),l=e.width||i.offsetWidth,o=e.height||i.offsetHeight;"absolute"!=i.style.position&&(i.style.position="absolute"),"hidden"!=i.parentElement.style.overflow&&(i.parentElement.style.overflow="hidden"),"relative"!=i.parentElement.style.position&&"absolute"!=i.parentElement.style.position&&"fixed"!=i.parentElement.style.position&&(i.parentElement.style.position="relative"),t(),window.onload=function(e){t()},window.onresize=function(e){t()},screen.addEventListener("orientationchange",function(){t()})}
|
function containElement(e){function t(){var o=l.parentElement.offsetWidth,a=l.parentElement.offsetHeight;if(o&&a){if(n=o>a/(s*n)*i*n?o/i:a/s,l.style.width=i*n+"px",l.style.height=s*n+"px",i*n>o)switch(e.halign){case"left":l.style.left="0px";break;case"right":l.style.left=0-(i*n-o)+"px";break;default:l.style.left=0-(i*n-o)/2+"px"}else l.style.left="0px";if(s*n>a)switch(e.valign){case"top":l.style.top="0px";break;case"bottom":l.style.top=0-(s*n-a)+"px";break;default:l.style.top=0-(s*n-a)/2+"px"}else l.style.top="0px"}else window.setTimeout(t,30)}var n=1,l=document.getElementById(e.id),i=e.width||l.offsetWidth,s=e.height||l.offsetHeight;"absolute"!=l.style.position&&(l.style.position="absolute"),"hidden"!=l.parentElement.style.overflow&&(l.parentElement.style.overflow="hidden"),"relative"!=l.parentElement.style.position&&"absolute"!=l.parentElement.style.position&&"fixed"!=l.parentElement.style.position&&(l.parentElement.style.position="relative"),t(),window.onresize=function(e){t()},screen.addEventListener("orientationchange",function(){t()})}
|
Loading…
Reference in a new issue