mirror of
https://github.com/WilliamsNY/contain-element.git
synced 2024-12-26 08:34:34 -05:00
Update minified version
This commit is contained in:
parent
fc9f124c7c
commit
f5abdade9a
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 n=s.parentElement.offsetWidth,a=s.parentElement.offsetHeight;if(n&&a){if(l=n>a/(o*l)*i*l?n/i:a/o,s.style.width=i*l+"px",s.style.height=o*l+"px",i*l>n)switch(e.halign){case"left":s.style.left="0px";break;case"right":s.style.left=0-(i*l-n)+"px";break;default:s.style.left=0-(i*l-n)/2+"px"}else s.style.left="0px";if(o*l>a)switch(e.valign){case"top":s.style.top="0px";break;case"bottom":s.style.top=0-(o*l-a)+"px";break;default:s.style.top=0-(o*l-a)/2+"px"}else s.style.top="0px"}else window.setTimeout(t,30)}var l=1,s=document.getElementById(e.id),i=e.width||s.offsetWidth,o=e.height||s.offsetHeight;"absolute"!=s.style.position&&(s.style.position="absolute"),"hidden"!=s.parentElement.style.overflow&&(s.parentElement.style.overflow="hidden"),-1===["relative","absolute","fixed"].indexOf(s.parentElement.style.position)&&(s.parentElement.style.position="relative"),t(),this.update=t}
|
||||
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}
|
Loading…
Reference in a new issue