hcfOverlayControl
open and manage overlay dialogs
by John Allan
JavaScript
/* hcfOverlayControl overlay class
by: John Allan
for: habanero
on: March 14 2012
*/
var hcfOverlayControl = (function () {
var elements = {},
values = {},
isOpen = function () {
return values.overlayOpen;
},
hrefToId = function (href) {
//converts href to id because IE prepends baseurl
return href.substr(href.indexOf('#') + 1);
},
getContainerHeight = function () {
return elements.elBody.height();
},
getContainerWidth = function () {
return elements.elBody.width();
},
updateContainerDimensions = function () {
values.containerHeight = getContainerHeight();
values.containerWidth = getContainerWidth();
},
getWindowHeight = function () {
return elements.elWindow.height();
},
getWindowWidth = function () {
return elements.elWindow.width();
},
getWindowScroll = function () {
return elements.elWindow[0].scrollTop;
},
updateWindowDimensions = function () {
values.windowHeight = getWindowHeight();
values.windowWidth = getWindowWidth();
values.windowScroll = getWindowScroll();
},
getDialogWidth = function () {
return elements.elDialog.width();
},
getDialogHeight = function () {
return elements.elDialog.height();
},
updateDialogDimensions = function () {
values.dialogHeight = getDialogHeight();
values.dialogWidth = getDialogWidth();
},
resizeOverlay = function () {
var contentMargin;
if (values.overlayOpen) {
updateContainerDimensions();
elements.elOverlay.css({
height: values.containerHeight,
width: values.containerWidth
});
}
...