2015-06-30 16:34:11 -04:00
|
|
|
function containElement(e){function t(){var s=i.parfunction 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(){t()},window.onresize=function(){t()},screen.addEventListener("orientationchange",function(){t()})}entElement.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(){t()},window.onresize=function(){t()},screen.addEventListener("orientationchange",function(){t()})}
|