;(function () { 'use strict'; // iPad and iPod detection var isiPad = function(){ return (navigator.platform.indexOf("iPad") != -1); }; var isiPhone = function(){ return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) ); }; // Owl Carousel var owlCrouselFeatureSlide = function() { var owl = $('.owl-carousel1'); owl.owlCarousel({ items: 1, loop: true, margin: 0, responsiveClass: true, nav: true, dots: true, smartSpeed: 500, navText: [ "", "" ] }); $('.owl-carousel2').owlCarousel({ loop:true, margin:10, nav:true, dots: true, responsive:{ 0:{ items:1 }, 600:{ items:3 }, 1000:{ items:3 } }, navText: [ "", "" ] }) }; // Owl Carousel // Parallax var parallax = function() { $(window).stellar(); }; var goToTop = function() { $('.js-gotop').on('click', function(event){ event.preventDefault(); $('html, body').animate({ scrollTop: $('html').offset().top }, 500); return false; }); }; // Offcanvas and cloning of the main menu var offcanvas = function() { var $clone = $('.nav').clone(); $clone.attr({ 'id' : 'offcanvas-menu' }); $clone.find('> ul').attr({ 'class' : '', 'id' : '' }); $('.box-wrap').prepend($clone); // click the burger $('.js-dsn-nav-toggle').on('click', function(){ if ( $('body').hasClass('dsn-offcanvas') ) { $('body').removeClass('dsn-offcanvas'); } else { $('body').addClass('dsn-offcanvas'); } // $('body').toggleClass('dsn-offcanvas'); }); $('#offcanvas-menu').css('height', $(window).height()); $(window).resize(function(){ var w = $(window); $('#offcanvas-menu').css('height', w.height()); if ( w.width() > 769 ) { if ( $('body').hasClass('dsn-offcanvas') ) { $('body').removeClass('dsn-offcanvas'); } } }); } // Window Scroll var windowScroll = function() { var lastScrollTop = 0; $(window).scroll(function(event){ var header = $('#dsn-header'), scrlTop = $(this).scrollTop(); if ( scrlTop > 500 && scrlTop <= 2000 ) { header.addClass('navbar-fixed-top dsn-animated slideInDown'); } else if ( scrlTop <= 500) { if ( header.hasClass('navbar-fixed-top') ) { header.addClass('navbar-fixed-top dsn-animated slideOutUp'); setTimeout(function(){ header.removeClass('navbar-fixed-top dsn-animated slideInDown slideOutUp'); }, 100 ); } } }); }; // 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 { el.addClass('fadeInUp animated'); } el.removeClass('item-animate'); }, k * 200, 'easeInOutExpo' ); }); }, 100); } } , { offset: '85%' } ); }; // designer24 170412 추가 // 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(){ // Animations owlCrouselFeatureSlide(); contentWayPoint(); parallax(); magnifPopup(); // designer24 170412 추가 }); }());