/** * @copyright (c) luft co.,ltd. * @link * @date 2022.11.01 * @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', FAQ: 'lf_faq_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'); this.$lf_g_nav_li = $('#lf_g_nav_upper > ul > li a'); // 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); that.$lf_g_nav_li.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); } if(that.$wrapper.hasClass(that.directory.FAQ)) { that.SceneModule = new SceneFaqPage(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','72px'); } else { that.$lf_pagetop.css('bottom','-72px'); } } if($(window).scrollTop() > 0){ that.$body.addClass('lf_header_scroll'); } else { that.$body.removeClass('lf_header_scroll'); } //effect-scroll $('.lf_effect-fade').each(function(i){ var elemPos = $(this).offset().top; var scroll = $(window).scrollTop(); var windowHeight = $(window).height(); if (scroll > elemPos - windowHeight){ $(this).addClass('lf_effect-scroll'); } }); //scale-scroll $('.lf_scale-fade').each(function(i){ var elemPos = $(this).offset().top; var scroll = $(window).scrollTop(); var windowHeight = $(window).height(); if (scroll > elemPos - windowHeight){ $(this).addClass('lf_scale-scroll'); } }); $(window).trigger(Main.prototype.SCROLL); }; /** * onLoad */ $(function() { //DefaultSetup $().DefaultSetup(); //Main Call new Main(); if($('#lf_matchHeight').length){ $('#lf_matchHeight li dl dd').matchHeight(); } }); }).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; that.$lf_sectab_block01 = $('.lf_sectab_block01'); that.$lf_sectab_block02 = $('.lf_sectab_block02'); that.$lf_rt = $('.lf_rt'); that.$lf_fs = $('.lf_fs'); that.$lf_rt_btn = $('.lf_rt_btn'); that.$lf_fs_btn = $('.lf_fs_btn'); // Initialize that.Init(); } SceneTopPage.prototype = { /** * Init */ Init: function() { var that = this; $(window).on('resize', that, that.ResizeHandlerTop).trigger('resize'); // Setup that.Setup(); }, /** * Setup */ Setup: function() { var that = this; that.$lf_rt_btn.on('click', that, that.rtFn); that.$lf_fs_btn.on('click', that, that.fsFn); } }; /** * rt Event Handler * @param e {Event} */ SceneTopPage.prototype.rtFn = function(e) { var that = e?e.data:this; if(!that) return; that.$lf_rt.show(); that.$lf_fs.hide(); that.$lf_sectab_block01.show(); that.$lf_sectab_block02.hide(); }; /** * fs Event Handler * @param e {Event} */ SceneTopPage.prototype.fsFn = function(e) { var that = e?e.data:this; if(!that) return; that.$lf_rt.hide(); that.$lf_fs.show(); that.$lf_sectab_block01.hide(); that.$lf_sectab_block02.show(); }; /** * Resize Event Handler * @param e {Event} */ SceneTopPage.prototype.ResizeHandlerTop = function(e) { var that = e?e.data:this; if(!that) return; }; return SceneTopPage; })(); /* ====================================== * [Scene] FAQ * ====================================== */ /** * SceneFaqPage */ var SceneFaqPage = (function(parent,element) { function SceneFaqPage(parent,element) { var that = this; that.parent = parent; that.element = element; that.directoryName = that.parent.directoryName; that.$lf_faq_dt = $('.lf_faq > dt'); // Initialize that.Init(); } SceneFaqPage.prototype = { /** * Init */ Init: function() { var that = this; // Setup that.Setup(); }, /** * Setup */ Setup: function() { var that = this; //faq that.$lf_faq_dt.on('click', that, that.faqFn); } }; /** * faqFn * @param e {Event} */ SceneFaqPage.prototype.faqFn = function(e) { var that = e?e.data:this; if(!that) return; if($(this).hasClass('lf_open')){ $(this).removeClass('lf_open'); } else { $(this).addClass('lf_open'); } }; /** * Resize Event Handler * @param e {Event} */ SceneFaqPage.prototype.ResizeHandlerTop = function(e) { var that = e?e.data:this; if(!that) return; }; return SceneFaqPage; })();