jQuery(document).ready(function ($) {
"use strict";
// Youtube modal
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
type:'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false
});
//iframe scripts
$.extend(true, $.magnificPopup.defaults, {
iframe: {
patterns: {
//youtube videos
youtube: {
index: 'youtube.com/',
id: function(url) {
var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/);
if ( !m || !m[1] ) return null;
return m[1];
},
src: '//www.youtube.com/embed/%id%?autoplay=1'
},
vimeo: {
index: 'vimeo.com/',
id: function(url) {
var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/);
if ( !m || !m[5] ) return null;
return m[5];
},
src: '//player.vimeo.com/video/%id%?autoplay=1'
},
gmaps: {
index: '//maps.google.',
src: '%id%&output=embed'
}
}
}
});
$('.image-link').magnificPopup({
image: {
markup: '
', // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button
cursor: 'mfp-zoom-out-cur', // Class that adds zoom cursor, will be added to body. Set to null to disable zoom out cursor.
titleSrc: 'title', // Attribute of the target element that contains caption for the slide.
// Or the function that should return the title. For example:
// titleSrc: function(item) {
// return item.el.attr('title') + 'by Marsel Van Oosten';
// }
verticalFit: true, // Fits image in area vertically
tError: 'The image could not be loaded.' // Error message
}
});
//scroll to top
$(document).ready(function(){
$(window).scroll(function () {
if ($(this).scrollTop() > 500) {
$('#scroller').fadeIn().css({'transform': 'scale(1)', 'opacity': '1'});
} else {
$('#scroller').fadeOut().css({'transform': 'scale(2)', 'opacity': '0'});
}
});
$('#scroller').on('click', function () {
$('body,html').animate({
scrollTop: 0
}, 400);
return false;
});
});
/* Sticky Top menu*/
var $menu = $("#stickymenu");
if($(window).width()>960){
$(window).scroll(function(){
if ( $(this).scrollTop() > 100 && $menu.hasClass("default") ){
$menu.removeClass("default").addClass("fixed animated slideInDown");
} else if($(this).scrollTop() <= 100 && $menu.hasClass("fixed")) {
$menu.removeClass("fixed animated slideInDown").addClass("default");
}
});
}
// Responsive menu
$('#myTopnav').on('click', function () {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
});
/* Page loading animation */
$(window).load(function() {
$('.loaderbgr').fadeOut();
});
/* Search Line in menu*/
$('.open-search, .search-sbmt-close').on('click', function () {
$('.search-block').toggleClass('opened-search');
$('.open-search').toggleClass('opacity0');
});
/* Show menu container */
$('#show').on('click', function () {
$('.menu-container').css('top', '0');
});
$('#hide').on('click', function () {
$('.menu-container').css('top', '-3000px');
});
/**
* File skip-link-focus-fix.js.
*
* Helps with accessibility for keyboard only users.
*
* Learn more: https://git.io/vWdr2
*/
( function() {
var isWebkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1,
isOpera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1,
isIe = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1;
if ( ( isWebkit || isOpera || isIe ) && document.getElementById && window.addEventListener ) {
window.addEventListener( 'hashchange', function() {
var id = location.hash.substring( 1 ),
element;
if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) {
return;
}
element = document.getElementById( id );
if ( element ) {
if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) {
element.tabIndex = -1;
}
element.focus();
}
}, false );
}
})();
});
!function (e, t, n) {
"use strict";
var slm_menu_li = e.getElementsByClassName('slm-mega-item slm-menu-item-depth-0');
var len = slm_menu_li.length;
var $menu = jQuery('#stickymenu');
for (var i = 0, len; i < len; i++) {
if ((getComputedStyle(slm_menu_li[i]).float == 'none' || getComputedStyle(slm_menu_li[i]).float == '') &&
(getComputedStyle(slm_menu_li[i]).display == 'block' || getComputedStyle(slm_menu_li[i]).display == 'flex' ||
getComputedStyle(slm_menu_li[i]).display == '' || getComputedStyle(slm_menu_li[i]).display == 'list-item' )){
slm_menu_li[i].classList.add('slm-vertical-menu-item');
}
}
t.onresize = function(event) {
var slm_menu_li = e.getElementsByClassName('slm-mega-item slm-menu-item-depth-0');
var len = slm_menu_li.length;
for (var i = 0, len; i < len; i++) {
if ((getComputedStyle(slm_menu_li[i]).float == 'none' || getComputedStyle(slm_menu_li[i]).float == '') &&
(getComputedStyle(slm_menu_li[i]).display == 'block' || getComputedStyle(slm_menu_li[i]).display == 'flex' ||
getComputedStyle(slm_menu_li[i]).display == '' || getComputedStyle(slm_menu_li[i]).display == 'list-item' )){
slm_menu_li[i].classList.add('slm-vertical-menu-item');
} else {
slm_menu_li[i].classList.remove('slm-vertical-menu-item');
}
}
};
[].forEach.call(e.querySelectorAll(".slm-open-menu-list"),function(b){b.addEventListener('click',function () {
var m = b.parentNode.parentNode.getElementsByClassName('slmm-mobile-hide')[0];
true == b.classList.contains("menu-shown") ? (m.classList.toggle("shown"), b.classList.toggle("menu-shown")) : (m.classList.toggle("shown"),
b.classList.toggle("menu-shown"));
},false)});
[].forEach.call(e.querySelectorAll(".slm-search-icon"),function(b){b.addEventListener('click',function () {
b.parentNode.parentNode.classList.add("no-flip");
b.parentNode.getElementsByClassName('slm-search-block')[0].style.display='block';
b.parentNode.getElementsByClassName('slm-search-block')[0].getElementsByClassName('slm-search-input')[0].focus();
},false)});
[].forEach.call(e.querySelectorAll(".slm-search-block"),function(b){b.addEventListener('click',function (e) {
if ( 'input' != e.target.localName) {
b.style.display='none';
}
},false)});
[].forEach.call(e.querySelectorAll("[class *= menu-item]"),function(b){b.addEventListener('mouseover',function () {
b.style.zIndex=2;
},false)});
[].forEach.call(e.querySelectorAll("[class *= menu-item]"),function(b){b.addEventListener('mouseout',function () {
b.style.zIndex=1;
},false)});
if(jQuery(t).width()>960){
jQuery(t).scroll(function(){
if ( jQuery(this).scrollTop() > 100 && !$menu.hasClass("fixed") ){
$menu.addClass("fixed");
} else if(jQuery(this).scrollTop() <= 100 && $menu.hasClass("fixed")) {
$menu.removeClass("fixed");
}
});
}
}(document, window);