| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /**
- * Initialize the Layout of LungoJS (if it's a mobile environment)
- *
- * @namespace Lungo.Boot
- * @class Layout
- *
- * @author Javier Jimenez Villar <javi@tapquo.com> || @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()) {
- _window = window;
- _document = _window.document;
- _resizeLayout();
- }
- };
- var _resizeLayout = function() {
- 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 ){
- _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);
|