/** * @copyright (c) luft co.,ltd. * @link * @date 2017.05.26 * @project ドメイン名 * @required * @author Nao Egami */ /* ====================================== * Main * ====================================== */ var Main = {}; (function(){ Main = function() { Main.prototype.RESIZE = 'main_resize'; Main.prototype.SCROLL = 'main_scroll'; // Stage Propaty Main.prototype.STAGE_WIDTH = null; Main.prototype.STAGE_HEIGHT = null; // Directory Main.prototype.SceneModule = null; Main.prototype.directoryName = null; Main.prototype.directory = { ROOT: 'lf_top_page', }; this.$html = $('html'); this.$body = $('body'); this.$wrapper = $('#lf_wrapper'); this.$lf_g_nav_btn = $('#lf_g_nav_btn'); this.$lf_overlay = $('#lf_overlay'); this.$lf_pagetop = $('#lf_pagetop'); // Initialize this.Init(); }; Main.prototype = { /** * Init */ Init: function() { var that = this; $(window) .on('resize', that, that.ResizeHandler).trigger('resize') .on('scroll', that, that.ScrollHandler).trigger('scroll'); // Setup that.Setup(); }, /** * Setup */ Setup: function() { var that = this; that.DirectoryManager(); //gNav that.$lf_g_nav_btn.on('click', that, that.gNavFn); } }; /** * Directory Manager */ Main.prototype.DirectoryManager = function() { var that = this; Main.prototype.directoryName = that.$wrapper.attr('class'); if(that.$wrapper.hasClass(that.directory.ROOT)) { that.SceneModule = new SceneTopPage(this, that.$wrapper); } }; /** * gNavFn * @param e {Event} */ Main.prototype.gNavFn = function(e) { var that = e?e.data:this; if(!that) return; if(that.$body.hasClass('lf_nav_open')){ that.$body.removeClass('lf_nav_open'); } else { that.$body.addClass('lf_nav_open'); } }; /** * Resize Event Handler * @param e {Event} */ Main.prototype.ResizeHandler = function(e) { var that = e?e.data:this; if(!that) return; // [GET] Stage Property Main.prototype.STAGE_WIDTH = util.getBrowser.width(); Main.prototype.STAGE_HEIGHT = util.getBrowser.height(); $(window).trigger(Main.prototype.RESIZE); }; /** * Scroll Event Handler * @param e {Event} */ Main.prototype.ScrollHandler = function(e) { var that = e?e.data:this; if(!that) return; //pagetop if(Main.prototype.STAGE_WIDTH > 767){ if($(window).scrollTop() >= 200){ that.$lf_pagetop.css('bottom','72px'); } else { that.$lf_pagetop.css('bottom','-72px'); } } else { if($(window).scrollTop() >= 150){ that.$lf_pagetop.css('bottom','50px'); } else { that.$lf_pagetop.css('bottom','-50px'); } } // if($(window).scrollTop() > 0){ // that.$body.addClass('lf_header_scroll'); // } else { // that.$body.removeClass('lf_header_scroll'); // } $(window).trigger(Main.prototype.SCROLL); }; /** * onLoad */ $(function() { //DefaultSetup $().DefaultSetup(); //Main Call new Main(); }); }).call(this); /* ====================================== * [Scene] ROOT / TOP * ====================================== */ /** * SceneTopPage */ var SceneTopPage = (function(parent,element) { function SceneTopPage(parent,element) { var that = this; that.parent = parent; that.element = element; that.directoryName = that.parent.directoryName; // Initialize that.Init(); } SceneTopPage.prototype = { /** * Init */ Init: function() { var that = this; // Setup that.Setup(); }, /** * Setup */ Setup: function() { var that = this; } }; /** * Resize Event Handler * @param e {Event} */ SceneTopPage.prototype.ResizeHandlerTop = function(e) { var that = e?e.data:this; if(!that) return; }; return SceneTopPage; })();