/** * Initialize the Layout of LungoJS (if it's a mobile environment) * * @namespace Lungo.Boot * @class Layout * * @author Javier Jimenez Villar || @soyjavi */ Lungo.Boot.Layout = (function(lng, undefined) { var _window = null; var _document = null; var ELEMENT = lng.Constants.ELEMENT; var ATTRIBUTE = lng.Constants.ATTRIBUTE; /** * Initializes the automatic subscription events by markup of the project. * * @method init * */ var init = function() { if (lng.Core.isMobile()) { _resizeLayout(); } }; var _resizeLayout = function() { _window = window; if (_window.innerHeight == 356) { var _height = 416; lng.dom(ELEMENT.BODY).style(ATTRIBUTE.HEIGHT, _height + ATTRIBUTE.PIXEL); _hideNavigationBar(); } }; var _hideNavigationBar = function() { if( !location.hash || !_window.addEventListener ) { _document = _window.document; _window.scrollTo( 0, 1 ); var scrollTop = 1, //reset to 0 on bodyready, if needed bodycheck = setInterval(function(){ if( _document.body ){ clearInterval( bodycheck ); scrollTop = 'scrollTop' in _document.body ? _document.body.scrollTop : 1; _window.scrollTo( 0, scrollTop === 1 ? 0 : 1 ); } }, 15 ); _window.addEventListener('load', function(){ setTimeout(function(){ _window.scrollTo( 0, scrollTop === 1 ? 0 : 1 ); }, 0); }, false ); } }; return { init: init }; })(Lungo);