;(function () {
// 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,
autoplay:true,
speed:800, // ½½¶óÀ̵ù ¼Óµµ
autoplayTimeout:5000,
autoplayHoverPause:false,
margin: 0,
responsiveClass: true,
nav: true,
dots: true,
smartSpeed: 500,
navText: [
"",
""
]
});
$('.photo').owlCarousel({
loop:true,
margin:10,
nav:true,
dots: true,
items:1,
navText: [
"",
""
]
})
$('.owl-carousel2').owlCarousel({
loop:true,
margin:0,
nav:true,
dots: true,
responsive:{
0:{
items:3,
},
600:{
items:3
},
1000:{
items:4
}
},
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-fh5co-nav-toggle').on('click', function(){
if ( $('body').hasClass('fh5co-offcanvas') ) {
$('body').removeClass('fh5co-offcanvas');
} else {
$('body').addClass('fh5co-offcanvas');
}
// $('body').toggleClass('fh5co-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('fh5co-offcanvas') ) {
$('body').removeClass('fh5co-offcanvas');
}
}
});
}
// Window Scroll
var windowScroll = function() {
var lastScrollTop = 0;
$(window).scroll(function(event){
var header = $('#fh5co-header'),
scrlTop = $(this).scrollTop();
if ( scrlTop > 500 && scrlTop <= 2000 ) {
header.addClass('navbar-fixed-top fh5co-animated slideInDown');
} else if ( scrlTop <= 500) {
if ( header.hasClass('navbar-fixed-top') ) {
header.addClass('navbar-fixed-top fh5co-animated slideOutUp');
setTimeout(function(){
header.removeClass('navbar-fixed-top fh5co-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%' } );
};
// Burger Menu
var burgerMenu = function() {
$('body').on('click', '.js-fh5co-nav-toggle', function(event){
if ( $('#navbar').is(':visible') ) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
}
event.preventDefault();
});
};
// Page Nav
var clickMenu = function() {
$('a:not([class="external"])').click(function(event){
var section = $(this).data('nav-section'),
navbar = $('#navbar');
$('html, body').animate({
scrollTop: $('[data-section="' + section + '"]').offset().top
}, 500);
if ( navbar.is(':visible')) {
navbar.removeClass('in');
navbar.attr('aria-expanded', 'false');
$('.js-fh5co-nav-toggle').removeClass('active');
}
event.preventDefault();
return false;
});
};
// Reflect scrolling in navigation
var navActive = function(section) {
var $el = $('#navbar > ul');
$el.find('li').removeClass('active');
$el.each(function(){
$(this).find('a[data-nav-section="'+section+'"]').closest('li').addClass('active');
});
};
var navigationSection = function() {
var $section = $('div[data-section]');
$section.waypoint(function(direction) {
if (direction === 'down') {
navActive($(this.element).data('section'));
}
}, {
offset: '150px'
});
$section.waypoint(function(direction) {
if (direction === 'up') {
navActive($(this.element).data('section'));
}
}, {
offset: function() { return -$(this.element).height() + 155; }
});
};
// Document on load.
$(function(){
// Animations
owlCrouselFeatureSlide();
contentWayPoint();
parallax();
burgerMenu();
clickMenu();
});
}());