- //================================================================================
- // default_layout.js
- //================================================================================
- //================================================================================
- // Start Layout Functions
- //================================================================================
- // ========================================
- // start position div from sum of multiple divs height
- // ========================================
- function positionFromHeightSum(idsOfDivsArr,iddivtochange,cssproperty,addmore) {
- //alert('test: ' + idsOfDivsArr + iddivtochange + topheight + addmore);
- var divheight = 0;
- $.each(idsOfDivsArr, function( index, idsOfDivVal ) {
- //alert('test' + idsOfDivVal );
- var heighttoadd = $(idsOfDivVal).height();
- //alert('heighttoadd: ' + heighttoadd );
- divheight = divheight + heighttoadd; //divheight + heighttoadd;
- });
- //alert('divheight: ' + divheight );
- var newheight = divheight + addmore;
- //alert('newheight: ' + newheight );
- $(iddivtochange).css(cssproperty,newheight);
- }
- // ========================================
- // end position div from sum of multiple divs height
- // ========================================
- // ========================================
- // start process autoheight based on container/box
- // ========================================
- function processAutoheight(autoHeightIdArr,autoHeightContainerId,autoHeightBoxId)
- {
- var totalAutoHeight = 0;
- //alert ('autoHeightIdArr: ' + autoHeightIdArr);
- $.each(autoHeightIdArr, function( index, autoHeightIdArr ) {
- //alert (autoHeightIdArr + ' autoHeightIdArr: ' + $(autoHeightIdArr).height() + ' totalAutoHeight: ' +totalAutoHeight);
- totalAutoHeight += $(autoHeightIdArr).height();
- });
- $('#page_box').css({
- //'background-color': '#FFFFCC',
- 'border': 'solid 3px #FF0000',
- 'margin-bottom': '0px',
- 'height': '100%'
- });
- $('#page_container').css({
- 'border': 'solid 3px #00FF00',
- 'margin-bottom': '70px',
- });
- var outerContainerHeight = $(autoHeightContainerId).height();
- var outerBoxHeight = $(autoHeightBoxId).height();
- alert ('Total Height: ' + totalAutoHeight);
- alert ('Outer Container Height: ' + outerContainerHeight);
- alert ('Outer Box Height: ' + outerBoxHeight);
- if ( outerContainerHeight <= totalAutoHeight ) {
- $('#page_container').css({
- //'height': totalAutoHeight + 'px'
- //'height': totalAutoHeight + 'px'
- 'height': totalAutoHeight + 'px'
- })
- }
- else {
- $('#page_container').css({
- 'height': '100%'
- })
- }
- }// end function processAutoheight
- //=====POOP
- // // Recalculate under any condition that the viewport dimension has changed
- // $(document).ready(function() {
- // //checkLoginState(); //poop
- //
- //
- // var autoHeightIdArr = [ "#resy_container","announce_container","#intro_box","#share_container","#copy_container"]; // should be built from config
- // var autoHeightContainerId = "#page_container";
- // var autoHeightBoxId = "#page_box";
- //
- // var winResizeCount = 0;
- // $(window).resize(function() {
- // //alert('window resize');
- //
- // winResizeCount++;
- // if (winResizeCount <= 1) {
- // //alert('resize started' + winResizeCount);
- // } else {
- // //alert('resize complete' + winResizeCount);
- // winResizeCount = 0;
- // processAutoheight(autoHeightIdArr,autoHeightContainerId,autoHeightBoxId);
- // }
- //
- // });
- //
- // //$(document).resize(function() {
- // //alert('doc resize');
- // //processAutoheight(autoHeightIdArr,outerBoxId);
- // //});
- //
- //
- //
- // });//end doc ready
- //=====POOP
- // ========================================
- // end process autoheight based on container/box
- // ========================================
- //------------------------poop
- function zoominoutLoopCallBack() {
- /*
- if (mediaType != 'xs') {
- resetZoomInOutData();
- }
- */
- }
- /*
- function resetZoomInOutData() {
- //alert('reset');
- var zoomSmall= '0.55';
- var zoomBig = '0.5';
- var randZoom = Math.floor(Math.random() * 2) + 1;
- var initZoom;
- var finZoom;
- if (randZoom == 1){
- var initZoom = zoomSmall;
- var finZoom = zoomBig;
- } else {
- var initZoom = zoomBig;
- var finZoom = zoomSmall;
- }
- //alert('initZoom: ' + initZoom + ' | finZoom: ' + finZoom);
- $('.zoominoutbox').attr('data-initialZoom', initZoom);
- $('.zoominoutbox').attr('data-finalZoom', finZoom);
- var randHorPos = Math.floor(Math.random() * 3) + 1;
- var randVertPos = Math.floor(Math.random() * 3) + 1;
- if (randHorPos == 1){
- randHorPos = "left";
- } else if (randHorPos == 2) {
- randHorPos = "center";
- } else {
- randHorPos = "right";
- }
- // if (randVertPos == 1){
- // randVertPos = "top";
- // } else if (randVertPos == 2) {
- // randVertPos = "center";
- // } else {
- // randVertPos = "bottom";
- // }
- randVertPos = "center";
- // alert('randHorPos: ' + randHorPos + ' | randVertPos: ' + randVertPos);
- $('.zoominoutbox').attr('data-horizontalPosition',randHorPos);
- $('.zoominoutbox').attr('data-verticalPosition',randVertPos);
- }
- */
- //------------------------poop
- //================================================================================
- // End Layout Functions
- //================================================================================