$(function() { /* Demo Scripts for Bootstrap Carousel and Animate.css */ $('.navbar').affix({ offset: { top: $('.header-inner').height() } }); //Function to animate slider captions function doAnimations( elems ) { //Cache the animationend event in a variable var animEndEv = 'webkitAnimationEnd animationend'; elems.each(function () { var $this = $(this), $animationType = $this.data('animation'); $this.addClass($animationType).one(animEndEv, function () { $this.removeClass($animationType); }); }); } //Variables on page load var $myCarousel = $('#home-slider'), $firstAnimatingElems = $myCarousel.find('.item:first').find("[data-animation ^= 'animated']"); //Initialize carousel $myCarousel.carousel(); //Animate captions in first slide on page load doAnimations($firstAnimatingElems); //Pause carousel $myCarousel.carousel('pause'); //Other slides to be animated on carousel slide event $myCarousel.on('slide.bs.carousel', function (e) { var $animatingElems = $(e.relatedTarget).find("[data-animation ^= 'animated']"); doAnimations($animatingElems); }); // Project Scroll Js $('#home-blog .item').each(function(){ var next = $(this).next(); if (!next.length) { next = $(this).siblings(':first'); } next.children(':first-child').clone().appendTo($(this)); for (var i=0;i<1;i++) { next=next.next(); if (!next.length) { next = $(this).siblings(':first'); } next.children(':first-child').clone().appendTo($(this)); } }); //main menu on hover jQuery(document).ready(function() { jQuery('.nav li.dropdown').hover(function() { jQuery(this).addClass('open'); }, function() { jQuery(this).removeClass('open'); }); }); /*-- Page Scroll To Top Section ---------------*/ jQuery(document).ready(function () { jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 100) { jQuery('.hc_scrollup').fadeIn(); } else { jQuery('.hc_scrollup').fadeOut(); } }); jQuery('.hc_scrollup').click(function () { jQuery("html, body").animate({ scrollTop: 0 }, 600); return false; }); }); //------PhotoBox Js------------// !(function(){ 'use stnonerict'; // finally, initialize photobox on all retrieved images $('#gallery').photobox('.photobox_a'); $('#gallery').photobox('.photobox_a:first', { thumbs:false, time:0 }, imageLoaded); function imageLoaded(){ console.log('image has been loaded...' ); } })(jQuery); //WOW animation new WOW().init(); }); // Added in Version 5.4 // Mobile Menu (function($) { $.fn.sidebarmenu = function(options) { var sidebarmenuleft = $(this), settings = $.extend({ title: "Menu", format: "dropdown", sticky: false }, options); return this.each(function() { $(this).find("#menu-button").on('click', function(){ $(this).toggleClass('menu-opened'); var mainmenu = $(this).next('ul'); if (mainmenu.hasClass('open')) { mainmenu.hide().removeClass('open'); } else { mainmenu.show().addClass('open'); if (settings.format === "dropdown") { mainmenu.find('ul').show(); } } }); sidebarmenuleft.find('li ul').parent().addClass('has-sub'); multiTg = function() { sidebarmenuleft.find(".has-sub").prepend(''); sidebarmenuleft.find('.submenu-button').on('click', function() { $(this).toggleClass('submenu-opened'); if ($(this).siblings('ul').hasClass('open')) { $(this).siblings('ul').removeClass('open').hide(); } else { $(this).siblings('ul').addClass('open').show(); } }); }; if (settings.format === 'multitoggle') multiTg(); else sidebarmenuleft.addClass('dropdown'); if (settings.sticky === true) sidebarmenuleft.css('position', 'fixed'); }); }; })(jQuery); (function($){ $(document).ready(function(){ $("#sidebarmenuleft").sidebarmenu({ title: "Menu", format: "multitoggle" }); }); // closebtn // $('.mobileshow ul li a:last').focusout(function(){ // $('.closebtn').focus(); // }); })(jQuery); function openNav() { document.getElementById("mySidenav").style.width = "300px"; findInsiders($('.mobileshow')); } function closeNav() { document.getElementById("mySidenav").style.width = "0"; $(".sidebar-menu a").focus(); } window.lastTabbable = ''; var findInsiders = function(elem) { var tabbable = elem.find('input, button, a').filter(':visible'); var firstTabbable = tabbable.first(); if(tabbable.last().next().children().length == 0){ lastTabbable = tabbable.last(); } else{ tabbable.last().focus(function(){ // alert('test'); $(this).addClass('show'); tabbable.last().next().addClass('show'); }) tabbable.last().next().children().last().focusout(function(){ tabbable.last().removeClass('show'); tabbable.last().next().removeClass('show'); }); lastTabbable = tabbable.last().next().children().last(); } /*set focus on first input*/ firstTabbable.focus(); /*redirect last tab to first input*/ lastTabbable.on('keydown', function (e) { if ((e.which === 9 && !e.shiftKey)) { e.preventDefault(); firstTabbable.focus(); } }); /*redirect first shift+tab to last input*/ firstTabbable.on('keydown', function (e) { if ((e.which === 9 && e.shiftKey)) { e.preventDefault(); lastTabbable.focus(); } }); };