/** * @copyright (c) luft co.,ltd. * @link * @date 2020.09.23 * @project komei-osaka.jp * @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'); 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); } }; /** * 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','110px'); } 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'); } $(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; that.$lf_main_img = $('#lf_main_img'); that.$lf_scroll_main = $('#lf_main_img .lf_scroll_main'); that.$lf_scroll1 = $('#lf_main_img .lf_scroll_main .lf_scroll1'); that.$lf_scroll_bottom = $('#lf_main_img .lf_scroll_bottom'); that.startPos = 0; that.winScrollTop = 0; that.$lf_yes = $('#lf_yes'); that.Pos = $('#lf_everyone').offset().top; that.Posflag = 0; that.Scrollflag = 0; that.$lf_accordion_dt = $('.lf_accordion > dt'); that.$lf_accordion_dd = $('.lf_accordion > dd'); // Initialize that.Init(); } SceneTopPage.prototype = { /** * Init */ Init: function() { var that = this; $(window).on('resize', that, that.ResizeHandlerTop).trigger('resize'); $(window).on('scroll', that, that.ScrollHandlerTop).trigger('scroll'); // Setup that.Setup(); }, /** * Setup */ Setup: function() { var that = this; that.$lf_scroll_main.addClass('lf_load'); setTimeout(function(){ that.$lf_scroll_bottom.addClass('lf_load'); },700); setTimeout(function(){ that.Scrollflag = 1; },1700); that.$lf_accordion_dt.on('click', that, that.accordionFn); } }; /** * gNavFn * @param e {Event} */ SceneTopPage.prototype.accordionFn = function(e) { var that = e?e.data:this; if(!that) return; if($(this).hasClass('active')){ $(this).removeClass('active'); $(this).next('dd').removeClass('active'); } else { $(this).addClass('active'); $(this).next('dd').addClass('active'); } }; /** * Resize Event Handler * @param e {Event} */ SceneTopPage.prototype.ResizeHandlerTop = function(e) { var that = e?e.data:this; if(!that) return; if(Main.prototype.STAGE_HEIGHT < 980){ that.$lf_scroll1.width(parseInt(Main.prototype.STAGE_HEIGHT*520/661)-261); if(Main.prototype.STAGE_WIDTH < 769){ that.$lf_scroll1.width(""); } } else { that.$lf_scroll1.width(""); } if(Main.prototype.STAGE_WIDTH > 768){ that.$lf_main_img.height(parseInt(Main.prototype.STAGE_HEIGHT)-125); that.$lf_main_img.width(parseInt(Main.prototype.STAGE_WIDTH)); } else { that.$lf_main_img.height(parseInt(Main.prototype.STAGE_HEIGHT)-77); that.$lf_main_img.width(parseInt(Main.prototype.STAGE_WIDTH)); } }; /** * Scroll Event Handler * @param e {Event} */ SceneTopPage.prototype.ScrollHandlerTop = function(e) { var that = e?e.data:this; if(!that) return; that.winScrollTop = $(this).scrollTop(); if(that.winScrollTop >= that.startPos){ that.flagdown(); } that.startPos = that.winScrollTop; }; /** * Scroll Event Handler * @param e {Event} */ SceneTopPage.prototype.flagdown = function() { var that = this; if(that.Posflag == 0 && that.Scrollflag == 1){ //that.$lf_yes.trigger('click'); that.Posflag = 1; } }; return SceneTopPage; })(); /* [lf_interview_page]タグメニュー ======================================*/ // const tabs = document.querySelectorAll(".lf_cat_btn"); // const contents = document.querySelectorAll(".lf_content"); // // for(let i = 0; i < tabs.length; i++){ // tabs[i].addEventListener("click", function(index){ // for(let j = 0; j < tabs.length; j++){ // tabs[j].classList.remove("active"); // } // for(let i = 0; i < contents.length; i++){ // contents[i].classList.remove("active"); // } // // tabs[index].classList.add("active"); // contents[index].classList.add("active"); // }.bind(null, i)); // // }