;(function () { 'use strict'; var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; var fullHeight = function() { // if ( !isMobile.any() ) { $('.js-fullheight').css('height', $(window).height()); $(window).resize(function(){ $('.js-fullheight').css('height', $(window).height()); }); // } }; var parallax = function() { $(window).stellar({ horizontalScrolling: false, hideDistantElements: false, responsive: true }); }; var testimonialCarousel = function(){ var owl = $('.owl-carousel-fullwidth'); owl.owlCarousel({ items: 1, loop: true, margin: 0, responsiveClass: true, nav: false, dots: true, smartSpeed: 500, autoHeight: true }); }; // Animations var contentWayPoint = function() { var i = 0; $('.animate-box').waypoint( function( direction ) { if( direction === 'down' && !$(this.element).hasClass('animated') ) { i++; $(this.element).addClass('item-animate'); setTimeout(function(){ $('body .animate-box.item-animate').each(function(k){ var el = $(this); setTimeout( function () { var effect = el.data('animate-effect'); if ( effect === 'fadeIn') { el.addClass('fadeIn animated'); } else if ( effect === 'fadeInLeft') { el.addClass('fadeInLeft animated'); } else if ( effect === 'fadeInRight') { el.addClass('fadeInRight animated'); } else { el.addClass('fadeInUp animated'); } el.removeClass('item-animate'); }, k * 200, 'easeInOutExpo' ); }); }, 100); } } , { offset: '85%' } ); }; var counter = function() { $('.js-counter').countTo({ formatter: function (value, options) { return value.toFixed(options.decimals); }, }); }; var counterWayPoint = function() { if ($('#counter-animate').length > 0 ) { $('#counter-animate').waypoint( function( direction ) { if( direction === 'down' && !$(this.element).hasClass('animated') ) { setTimeout( counter , 400); $(this.element).addClass('animated'); } } , { offset: '90%' } ); } }; var burgerMenu = function() { $('.js-dsn-nav-toggle').on('click', function(event){ event.preventDefault(); var $this = $(this); if ($('body').hasClass('offcanvas')) { $this.removeClass('active'); $('body').removeClass('offcanvas'); } else { $this.addClass('active'); $('body').addClass('offcanvas'); } }); }; // Click outside of offcanvass var mobileMenuOutsideClick = function() { $(document).click(function (e) { var container = $("#dsn-aside, .js-dsn-nav-toggle"); if (!container.is(e.target) && container.has(e.target).length === 0) { if ( $('body').hasClass('offcanvas') ) { $('body').removeClass('offcanvas'); $('.js-dsn-nav-toggle').removeClass('active'); } } }); $(window).scroll(function(){ if ( $('body').hasClass('offcanvas') ) { $('body').removeClass('offcanvas'); $('.js-dsn-nav-toggle').removeClass('active'); } }); }; // designer24 170411 추가 // MagnificPopup var magnifPopup = function() { $('.image-popup').magnificPopup({ type: 'image', removalDelay: 300, mainClass: 'mfp-with-zoom', gallery:{ enabled:true }, zoom: { enabled: true, // By default it's false, so don't forget to enable it duration: 300, // duration of the effect, in milliseconds easing: 'ease-in-out', // CSS transition easing function // The "opener" function should return the element from which popup will be zoomed in // and to which popup will be scaled down // By defailt it looks for an image tag: opener: function(openerElement) { // openerElement is the element on which popup was initialized, in this case its tag // you don't need to add "opener" option if this code matches your needs, it's defailt one. return openerElement.is('img') ? openerElement : openerElement.find('img'); } } }); }; // Document on load. $(function(){ fullHeight(); parallax(); testimonialCarousel(); contentWayPoint(); counterWayPoint(); burgerMenu(); mobileMenuOutsideClick(); magnifPopup(); // designer24 170411 추가 }); }());