$(document).foundation(); var GCMSPage = function(pageName){ var $this = this, $window, $isTouch, page; $this.NAME = 'GCMSPage'; $this.config = { pageName: pageName, blockAni: false } var initHandler = function(){ $window = $(window); $isTouch = $this.is_touch_device(); $(document).on('sendAjax', $this.sendAjaxHandler); //$(document).trigger( 'sendAjax', {target: $classHandler, action: 'actionName', params: {param1: 1, param2: 2} } ); $(document).on('freezScroll', $this.freezScrollHandler); $(document).on('unFreezScroll', $this.unFreezScrollHandler); $(document).on('lock', $this.lockUI); $(document).on('unlock', $this.unlockUI); $window.on('scroll', $this.scrollHandler); $this.scrollHandler(); $this.prepareMenu(); if( $this.config.pageName != '' ){ $this.page = eval( 'new Page' + pageName + '()' ); $this.page.prepare($window, $isTouch); $this.page.init(); } $this.EUCookies(); resizeHandler(); } $this.scrollHandler = function(){ var scrollTop = $window.scrollTop(); } $this.prepareMenu = function(){ if ($(window).width() > 640) { $(".desktop-menu li.has-sub").on({ mouseenter: function () { $(".semi-bg").css("display","block"); }, mouseleave: function () { $(".semi-bg").css("display","none"); } }); } /* logo slider */ $('.logo-list').slick({ arrows:false, slidesToShow: 7, slidesToScroll: 1, autoplay: true, autoplaySpeed: 3000, speed:1000, responsive: [ { breakpoint: 640, settings: { arrows:false, slidesToShow: 3, slidesToScroll: 1, speed:1000, autoplay: true, autoplaySpeed: 3000 } } ] }); if(jQuery().fancybox) { if (jQuery(".fancybox-button").size() > 0) { jQuery(".fancybox-button").fancybox({ groupAttr: 'data-rel', prevEffect: 'none', nextEffect: 'none', closeBtn: true, helpers: { title: { type: 'inside' } } }); } } } $this.freezScrollHandler = function(){ $('body').unbind('mousewheel DOMMouseScroll scroll').bind('mousewheel DOMMouseScroll scroll', function(e) { e.preventDefault(); e.stopPropagation(); return false }); document.ontouchstart = function(e){ if( e.target.nodeName.toLowerCase() == 'a' ){ return true; } e.preventDefault(); } } $this.unFreezScrollHandler = function(){ $('body').unbind('mousewheel DOMMouseScroll scroll'); document.ontouchstart = function(e){ return true; } } $this.lockUI = function(){ $('#uiLock').addClass('show'); $this.freezScrollHandler(); } $this.unlockUI = function(){ $('#uiLock').removeClass('show'); $this.unFreezScrollHandler(); } $this.sendAjaxHandler = function(e, eData){ var target = eData.target; $.ajax({ type: 'POST', url: '', dataType: 'json', data: {action: eData.action, params: eData.params} }).done(function(data){ var i = 0; var l = data.length; for( i; i -1 || navigator.userAgent.indexOf("Touch") > -1 ){ isTouch = true; }else if( navigator.userAgent.indexOf("MSIE") > -1 || navigator.userAgent.indexOf("Trident") > -1 ){ if( !!('ontouchstart' in window) ){ isTouch = true; } }else if( !!('ontouchstart' in window) || !!('onmsgesturechange' in window) ){ if ( navigator.userAgent.match(/mobile/i) ) { isTouch = true; } } return isTouch; }; return { init: initHandler, resize: resizeHandler, load: loadHandler }; } var gCMSPage = new GCMSPage(pageName); $(document).ready(gCMSPage.init); $(window).load(gCMSPage.load); $(window).resize(gCMSPage.resize);