1/* ========================================================================== 2 3 Kallyas JS scripts. 4 Contains scripts dedicated for this template. 5 6 Do not change nothing as it will be constantly updated and your work might 7 get overwritten. 8 9========================================================================== */ 10 11//#! Enable with "1" or disable with "0" which functionality you want to use. 12var KallyasConfig = { 13 // Set your own domain to enable the Google search functionality on your website. 14 searchDomain: 'https://kallyas-template.net', 15 16 // Enable Chaser Menu (Chaser menu or Sticky Header, not both on the same time.) 17 enableChaserMenu: 0, 18 19 // The distance in pixels from the top of the page when to display the chaser menu 20 chaserMenuOffsetDisplay: 150, 21 22 // Enable Sticky Header 23 enableStickyHeader: 0, 24 25 // Enable Header ScrollSpy (Especially for One Page layouts that has OnePage menu (Landing Pages).) 26 enableScrollSpy: 0, 27 28 // Display the back to top button 29 enableBackToTop: 1 30}; 31//!#---------- 32 33 34 35/* 36* Closure for Page Load 37*/ 38(function($, window, document) { 39 "use strict"; 40 41// Define global vars 42 var $window = $(window), 43 $html = $("html"), 44 $body = $("body"), 45 $header = $("#header"); 46 47 48// Notice to prevent opening on a local environment 49 $(document).ready(function () { 50 if(window.location.href.indexOf("file:///") > -1) { 51 alert("Local environment warning!! \n\nSome of the features of this template might not work properly if the .html file is opened locally. \n\nFor best results, please preview on a web server (either http://yourdomain.com/kallyas/ or from your computer with an emulated server eg: http://localhost/kallyas/ ). Please read the documentation to learn more. "); 52 } 53 }); 54// END Notice to prevent opening on a local environment 55 56 57// FIX mask for Safari Browser 58 if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)){ 59 document.getElementsByTagName('body')[0].className+=' is-safari'; 60 } 61// END FIX mask for Safari Browser 62 63 64// PRELOADER *to deactivate erase or comment this code* 65 $(window).on('load', function() { 66 $('body').removeClass('preloader'); 67 }); 68// END PRELOADER 69 70 71// Search panel 72 var searchBtn = $('#search').children('.searchBtn'), 73 searchPanel = searchBtn.next(), 74 searchP = searchBtn.parent(); 75 searchBtn.click(function(e){ 76 e.preventDefault(); 77 var _t = $(this); 78 if(!_t.hasClass('active')) { 79 _t.addClass('active') 80 .find('span') 81 .removeClass('fa-search white-icon') 82 .addClass('fa-times'); 83 searchPanel.show(); 84 } else { 85 _t.removeClass('active') 86 .find('span') 87 .addClass('fa-search white-icon') 88 .removeClass('fa-times'); 89 searchPanel.hide(); 90 } 91 }); // searchBtn.click // 92 93 $(document).click(function(){ 94 searchBtn.removeClass('active') 95 .find('span') 96 .addClass('fa-search white-icon') 97 .removeClass('fa-times'); 98 searchPanel.hide(0); 99 }); 100 101 searchP.click(function(event){ 102 event.stopPropagation(); 103 }); 104// END Search panel 105 106 107// Header search with Google 108 //@! Header Search Form 109 var searchForm = $('#searchform'); 110 if(searchForm){ 111 searchForm.on('submit', function(e){ 112 var searchInput = $(this).find('#q'); 113 var searchTerm = searchInput.val().replace('SEARCH ...', ''); 114 var qs = 'site:'+KallyasConfig.searchDomain +' '+searchInput.val(); 115 $(this).find('#q').val(qs); 116 window.setTimeout(function() { 117 searchInput.val(searchTerm); 118 }, 1000); 119 return true; 120 }); 121 } 122 //@! Sidebar search form 123 searchForm = $('#searchform-sidebar'); 124 if(searchForm){ 125 var searchInput = $('#s', searchForm); 126 searchForm.on('submit', function(e){ 127 var qs = 'site:'+KallyasConfig.searchDomain +' '+searchInput.val(); 128 $(this).find('#sq').val(qs); 129 return true; 130 }); 131 } 132 133// END Header search with Google 134 135 136// Search from pages with Google 137 var searchForms = $('.elm-searchbox__form'); 138 if (searchForms) { 139 searchForms.on('submit', function(e) { 140 var searchInput = $(this).find('.elm-searchbox__input'), 141 __search = searchInput.val(), 142 qs = 'site:' + KallyasConfig.searchDomain + ' ' + __search; 143 searchInput.val(qs); 144 window.setTimeout(function() { 145 searchInput.val(__search); 146 }, 1000); 147 return true; 148 }); 149 } 150// end Search from pages with Google 151 152 153// Add active class for menu items depending on the page loaded 154 (function(){ 155 var pathname = window.location.pathname, 156 page = pathname.split(/[/ ]+/).pop(), 157 menuItems = $('#menu-main-menu a'); 158 menuItems.each(function(){ 159 var mi = $(this), 160 miHrefs = mi.attr("href"), 161 miParents = mi.parents('li'); 162 if(page == miHrefs) { 163 miParents.addClass("active").siblings().removeClass('active'); 164 } 165 }); 166 })(); 167// END Add active class for menu items depending on the page loaded 168 169 170// Chaser menu 171 if (window.matchMedia('(min-width: 992px)').matches) {
172 if(KallyasConfig.enableChaserMenu && ! KallyasConfig.enableStickyHeader){ 173 var KT_Chaser = { 174 // Whether or not the chaser is visible 175 visible: false, 176 177 update: function( $header, headerStyleNumber ) 178 { 179 if(headerStyleNumber < 1){ 180 console.warn('[KT_Chaser::update] Error: Invalid header style number provided.'); 181 return; 182 } 183 184 // Clone needed elements from $header depending on the headerStyleNumber and generate chaser menu 185 this._createChaserByHeaderStyle( $header, headerStyleNumber ); 186 }, 187 188 // Clone needed elements from $header depending on the headerStyleNumber and generate chaser menu 189 _createChaserByHeaderStyle: function( $header, headerStyleNumber ) 190 { 191 // Show top bar when headerStyleNumber = [1,2,3] 192 var populateTopBar = ($.inArray(parseInt(headerStyleNumber,10), [1,2,3])); 193 194 // Update chaser's content 195 this._updateChaserHtml( $header, populateTopBar ); 196 }, 197 198 // Update the chaser menu's content 199 _updateChaserHtml: function( $header, populateTopBar ){ 200 populateTopBar = (populateTopBar > -1); 201 202 // Create new html structure 203 var chaserMenu = $('body .chaser'); 204 if( ! chaserMenu){ 205 return; 206 } 207 208 // Create chaser menu 209 $('#chaserMenuRow').html('') 210 //.append('<div class="col-sm-2 col-md-2" id="left-container"></div>') 211 .append('<div class="col-sm-12 col-md-12" id="right-container"></div>'); 212 213 // Add logo 214 //$('#left-container').html($('.logo-container', $header).clone(true)); 215 216 // Add the content in the right area 217 var rightContainer = $('#right-container'); 218 rightContainer 219 // Adding top bar 220 //.append('<div id="_wpk-custom-bar" class="col-sm-12 col-md-12"></div>') 221 // add main menu 222 .append('<div id="wpk-main-menu" class="col-sm-12 col-md-12"></div>') 223 // Add cta button 224 //.append('<div id="_wpk-cta-button" class="col-sm-1 col-md-1"></div>') 225 ; 226 227 // Add content in the newly created sections 228 // if(populateTopBar) { 229 // if($header.attr('data-header-style') == '2'){ 230 // $('#_wpk-custom-bar').html( $('<div style="height:32px;"></div>') ); 231 // } 232 // else if($header.attr('data-header-style') == '3'){ 233 // $('#_wpk-custom-bar').html( $('.kl-top-header').clone(true) ); 234 // } 235 // else { 236 // $('#_wpk-custom-bar').html( $('.kl-top-header').clone(true) ); 237 // } 238 // } 239 // else { 240 // $('#_wpk-custom-bar').html( $('<div style="height:32px;"></div>') ); 241 // } 242 243 //$('#_wpk-cta-button').html($('#ctabutton', $header).clone(true)); 244 245 $('#wpk-main-menu').html($('#menu-main-menu', $header).clone(true)); 246 247 //#! Remove search 248 chaserMenu.find('#search.header-search').remove(); 249 } 250 }; 251 252 if(KallyasConfig.enableChaserMenu) { 253 // ON LOAD 254 // the reference to the default header element 255 var _header = $('#header'), 256 // Default value for chaser's visibility 257 forch = KallyasConfig.chaserMenuOffsetDisplay; 258 259 // ENABLE HEADER STYLE CHANGING (the dropdown in options) 260 var header_style_option = _header.attr('data-header-style') || '1'; 261 262 263 // Setup references 264 var docMainMenu = $('#main-menu > ul'); 265 if(docMainMenu) { 266 // Set the default style for header 267 //_header.attr('data-header-style', header_style_option); 268 269 // Create chaser menu 270 $('<div id="chaserMenuRow" class="row"></div>') 271 .appendTo(document.body) 272 .wrap('<div class="chaser"><div class="container"></div></div>'); 273 274 // Set the chaser's visibility 275 var scrolled = $(window).scrollTop(), 276 // Get the reference to the chaser menu 277 _chaser = $('body .chaser'); 278 if(scrolled > forch) { 279 _chaser.addClass('visible'); 280 KT_Chaser.visible = true; 281 } 282 KT_Chaser.update( _header, _header.attr('data-header-style')); 283 } 284 // END if(docMainMenu) 285 286 var _chaser = $('body .chaser') 287 288 // OnScroll 289 $(window).scroll(function(e) { 290 291 var scrolled = $(window).scrollTop(); 292 293 if ( scrolled >= forch ) { 294 _chaser.addClass('visible'); 295 KT_Chaser.visible = true; 296 } 297 else if ( scrolled < forch ) { 298 _chaser.removeClass('visible'); 299 KT_Chaser.visible = false;
300 301 } 302 else { 303 // Triggered when the chaser menu is visible but doesn't have content. 304 // Only happens when the window is scrolled and then the page is refreshed. 305 if(_chaser.hasClass('visible') && $('#chaserMenuRow').html().trim() == ''){ 306 KT_Chaser.visible = true; 307 308 } 309 } 310 }); 311 // END onScroll 312 } 313 } 314 } 315// END Chaser menu 316 317 318// Sticky Header 319 if(KallyasConfig.enableStickyHeader && ! KallyasConfig.enableChaserMenu){ 320 var header = $('#header'); 321 322 $(window).scroll(function(){ 323 var scrolled = $(window).scrollTop(); 324 if(scrolled < 1){ 325 $body.removeClass('sticky-header'); 326 } 327 else if (scrolled > 0 && scrolled <= 9) { 328 $body.addClass('sticky-header'); 329 header.removeClass('header--is-sticked').addClass('header--no-sticked'); 330 } 331 else if (scrolled >= 10) { 332 header.addClass('header--is-sticked'); 333 } 334 else { 335 header.removeClass('header--is-sticked').addClass('header--no-sticked'); 336 } 337 }); 338 } 339// END Sticky Header 340 341 342// Responsive Main-Menu 343 var page_wrapper = $('#page_wrapper'), 344 responsive_trigger = $('.zn-res-trigger'), 345 zn_back_text = 'Atrás', 346 back_text = '<li class="zn_res_menu_go_back"><span class="zn_res_back_icon fas fa-chevron-left"></span><a href="#">'+zn_back_text+'</a><a href="#" class="zn-close-menu-button"><span class="fas fa-times"></span></a></li>', 347 cloned_menu = $('#main-menu > ul').clone().attr({id:"zn-res-menu", "class":""}); 348 349 var start_responsive_menu = function(){ 350 351 var responsive_menu = cloned_menu.prependTo(page_wrapper); 352 var responsive_menu_overlay = $('<div class="zn-res-menu-overlay"/>').insertAfter(cloned_menu); 353 354 var set_height = function(){ 355 var _menu = $('.zn-menu-visible').last(), 356 height = _menu.css({height:'auto'}).outerHeight(true), 357 window_height = $(window).height(), 358 adminbar_height = 0, 359 admin_bar = $('#wpadminbar'); 360 361 // CHECK IF WE HAVE THE ADMIN BAR VISIBLE 362 if(height < window_height) { 363 height = window_height; 364 if ( admin_bar.length > 0 ) { 365 adminbar_height = admin_bar.outerHeight(true); 366 height = height - adminbar_height; 367 } 368 } 369 _menu.attr('style',''); 370 page_wrapper.css({'height':height}); 371 }; 372 373 374 375 // BIND OPEN MENU TRIGGER 376 responsive_trigger.click(function(e){ 377 e.preventDefault(); 378 379 responsive_menu.addClass('zn-menu-visible'); 380 set_height(); 381 382 }); 383 384 // Close the menu when a link is clicked 385 responsive_menu.find( 'a:not([rel*="mfp-"])' ).on('click',function(e){ 386 $( '.zn_res_menu_go_back' ).first().trigger( 'click' ); 387 }); 388 389 // ADD ARROWS TO SUBMENUS TRIGGERS 390 responsive_menu.find('li:has(> ul)').addClass('zn_res_has_submenu').prepend('<span class="zn_res_submenu_trigger glyphicon glyphicon-chevron-right"></span>'); 391 // ADD BACK BUTTONS 392 responsive_menu.find('.zn_res_has_submenu > ul').addBack().prepend(back_text); 393 394 // REMOVE BACK BUTTON LINK 395 $( '.zn_res_menu_go_back' ).click(function(e){ 396 e.preventDefault(); 397 var active_menu = $(this).closest('.zn-menu-visible'); 398 active_menu.removeClass('zn-menu-visible'); 399 set_height(); 400 if( active_menu.is('#zn-res-menu') ) { 401 page_wrapper.css({'height':'auto'}); 402 } 403 }); 404 405 // OPEN SUBMENU'S ON CLICK 406 $('.zn_res_submenu_trigger').click(function(e){ 407 e.preventDefault(); 408 $(this).siblings('ul').addClass('zn-menu-visible'); 409 set_height(); 410 }); 411 412 var closeMenu = function(){ 413 cloned_menu.removeClass('zn-menu-visible'); 414 responsive_trigger.removeClass('is-active'); 415 removeHeight(); 416 }; 417 } 418 419 // MAIN TRIGGER FOR ACTIVATING THE RESPONSIVE MENU 420 var menu_activated = false, 421 triggerMenu = function(){ 422 if ( $(window).width() < 1200 ) { 423 if ( !menu_activated ){ 424 start_responsive_menu(); 425 menu_activated = true; 426 } 427 page_wrapper.addClass('zn_res_menu_visible'); 428 } 429 else{ 430 // WE SHOULD HIDE THE MENU 431 $('.zn-menu-visible').removeClass('zn-menu-visible'); 432 page_wrapper.css({'height':'auto'}).removeClass('zn_res_menu_visible'); 433 } 434 }; 435 436 $(document).ready(function() { 437 triggerMenu(); 438 }); 439 440 $( window ).on( 'load resize' , function(){ 441 triggerMenu(); 442 var is = false;
443 if ( $(window).width() < 1200 ) { 444 if(is) return; 445 //@wpk 446 // Close button for the responsive menu 447 var closeMenuSender = $('.zn-close-menu-button, .zn-res-menu-overlay'); 448 if(closeMenuSender){ 449 closeMenuSender.on('click', function(e){ 450 e.preventDefault(); 451 e.stopPropagation(); 452 var parent = $('#zn-res-menu'); 453 parent.removeClass('zn-menu-visible'); 454 //parent.removeClass('zn-menu-visible'); 455 $('.zn-menu-visible', parent).removeClass('zn-menu-visible'); 456 $('#page_wrapper').css({'height':'auto'}); 457 }); 458 } 459 is = true; 460 } 461 }); 462// END Responsive Main-Menu 463 464 465// Scroll to top 466 if(KallyasConfig.enableBackToTop){ 467 if ($('#totop').length) { 468 var scrollTrigger = 200, // px 469 backToTop = function () { 470 var scrollTop = $(window).scrollTop(); 471 if (scrollTop > scrollTrigger) { 472 $('#totop').addClass('show'); 473 } else { 474 $('#totop').removeClass('show'); 475 } 476 }; 477 backToTop(); 478 $(window).on('scroll', function () { 479 backToTop(); 480 }); 481 $('#totop').on('click', function (e) { 482 e.preventDefault(); 483 $('html,body').animate({ 484 scrollTop: 0 485 }, 700); 486 }); 487 } 488 } 489// END Scroll to top 490 491 492// Load Date in sub-header 493 var selector = $("#current-date"); 494 if( selector && selector.length > 0) 495 { 496 $.ajax({ 497 url: "php_helpers/date.php", 498 success: function(data){ 499 $("#current-date").html(data); 500 } 501 }); 502 } 503// END Load Date in sub-header 504 505 506// Kallyas Videos 507// Based on easy background video plugin 508// Example data setup attribute: 509// data-setup='{ "position": absolute, "loop": true , "autoplay": true, "muted": true, "mp4":"", "webm":"", "ogg":"" }' 510 if( typeof($('.kl-video')) !== 'undefined'){ 511 $('.kl-video').each(function(index, el) { 512 var $video = $(el), 513 _vid_controls = $video.next('.kl-video--controls'), 514 _vid_playplause = _vid_controls.find('.btn-toggleplay'), 515 _vid_audio = _vid_controls.find('.btn-audio'), 516 _data_attribs = $video.attr("data-setup"), 517 _options = typeof _data_attribs != 'undefined' ? JSON.parse(_data_attribs) : '{}'; 518 519 if(_options.height_container == true) 520 $video.closest('.kl-video-container').css('height', $video.height()); 521 522 if(_options.hasOwnProperty('muted') && _options.muted == true) _vid_audio.children('i').addClass('fa-volume-off'); 523 if(_options.hasOwnProperty('autoplay') && _options.autoplay == false) _vid_playplause.children('i').addClass('paused'); 524 525 if(typeof video_background != 'undefined') { 526 var Video_back = new video_background( $video, 527 { 528 //Stick within the div or fixed 529 "position": _options.hasOwnProperty('position') ? _options.position : "absolute", 530 //Behind everything 531 "z-index": _options.hasOwnProperty('zindex') ? _options.zindex : "-1", 532 533 //Loop when it reaches the end 534 "loop": _options.hasOwnProperty('loop') ? _options.loop : true, 535 //Autoplay at start 536 "autoplay": _options.hasOwnProperty('autoplay') ? _options.autoplay : false, 537 //Muted at start 538 "muted": _options.hasOwnProperty('muted') ? _options.muted : true, 539 540 //Path to video mp4 format 541 "mp4": _options.hasOwnProperty('mp4') ? _options.mp4 : false, 542 //Path to video webm format 543 "webm": _options.hasOwnProperty('webm') ? _options.webm : false, 544 //Path to video ogg/ogv format 545 "ogg": _options.hasOwnProperty('ogg') ? _options.ogg : false, 546 //Path to video flv format 547 "flv": _options.hasOwnProperty('flv') ? _options.flv : false, 548 //Fallback image path 549 "fallback_image": _options.hasOwnProperty('poster') ? _options.poster : false, 550 // Youtube Video ID 551 "youtube": _options.hasOwnProperty('youtube') ? _options.youtube : false, 552 553 // flash || html5 554 "priority": _options.hasOwnProperty('priority') ? _options.priority : "html5", 555 // width/height -> If none provided sizing of the video is set to adjust 556 "video_ratio": _options.hasOwnProperty('video_ratio') ? _options.video_ratio : false, 557 // fill || adjust 558 "sizing": _options.hasOwnProperty('sizing') ? _options.sizing : "fill", 559 // when to start 560 "start": _options.hasOwnProperty('start') ? _options.start : 0 561 }); 562 //Toggle play status 563 _vid_playplause.on('click',function(e){ 564 e.preventDefault(); 565 Video_back.toggle_play(); 566 $(this).children('i').toggleClass('paused'); 567 }); 568 //Toggle mute 569 _vid_audio.on('click',function(e){ 570 e.preventDefault(); 571 Video_back.toggle_mute(); 572 $(this).children('i').toggleClass('mute'); 573 }); 574 } 575 }); 576 } 577// END Kallyas Videos 578 579 580// Magnific Popup 581 if(typeof($.fn.magnificPopup) != 'undefined') 582 { 583 $('a.kl-login-box').magnificPopup({ 584 type: 'inline', 585 closeBtnInside:true, 586 showCloseBtn: true, 587 mainClass: 'mfp-fade mfp-bg-lighter' 588 }); 589 590 $('a[data-lightbox="image"]:not([data-type="video"])').each(function(i,el){ 591 //single image popup 592 if ($(el).parents('.gallery').length == 0) { 593 $(el).magnificPopup({ 594 type:'image', 595 tLoading: '', 596 mainClass: 'mfp-fade' 597 }); 598 } 599 }); 600 $('.mfp-gallery.images').each(function(i,el) { 601 $(el).magnificPopup({ 602 delegate: 'a', 603 type: 'image', 604 gallery: {enabled:true}, 605 tLoading: '', 606 mainClass: 'mfp-fade' 607 }); 608 }); 609 610 // Notice the .misc class, this is a gallery which contains a variatey of sources 611 // links in gallery need data-mfp attributes eg: data-mfp="image" 612 $('.mfp-gallery.misc').each(function(){ 613 $(this).magnificPopup({ 614 delegate: 'a[data-lightbox="mfp"]', 615 mainClass: 'mfp-fade', 616 type: 'image', 617 gallery: {enabled:true}, 618 tLoading: '', 619 callbacks: { 620 elementParse: function(item) { 621 item.type = $(item.el).attr('data-mfp'); 622 } 623 } 624 }); 625 }); 626 627 628 $('a[data-lightbox="iframe"]').magnificPopup({type: 'iframe', mainClass: 'mfp-fade', tLoading: ''}); 629 $('a[data-lightbox="inline"]').magnificPopup({type: 'inline', mainClass: 'mfp-fade', tLoading: ''}); 630 $('a[data-lightbox="ajax"]').magnificPopup({type: 'ajax', mainClass: 'mfp-fade', tLoading: ''}); 631 $('a[data-lightbox="youtube"], a[data-lightbox="vimeo"], a[data-lightbox="gmaps"], a[data-type="video"]').magnificPopup({ 632 disableOn: 700, 633 type: 'iframe', 634 removalDelay: 160, 635 preloader: true,
636 fixedContentPos: false, 637 mainClass: 'mfp-fade', 638 tLoading: '' 639 }); 640 641 // Enable WooCommerce lightbox 642 $('.single_product_main_image .images a').magnificPopup({ 643 mainClass: 'mfp-fade', 644 type: 'image', 645 gallery: {enabled:true}, 646 tLoading: '', 647 }); 648 } 649// END Magnific Popup 650 651 652// Flickr Feed 653 var content = $('.flickrfeed'); 654 if( content ){ 655 var elements = content.find('.flickr_feeds'); 656 if(elements && elements.length){ 657 $.each(elements, function(i, e){ 658 var self = $(e), 659 ff_limit = (self.attr('data-limit') ? self.attr('data-limit') : 6), 660 fid = self.attr('data-fid'); 661 if(typeof($.fn.jflickrfeed) != 'undefined') { 662 self.jflickrfeed({ 663 limit: ff_limit, 664 qstrings: { id: fid }, 665 itemTemplate: '<li><a href="{{image_b}}" data-lightbox="image"><img src="{{image_s}}" alt="{{title}}" /><span class="theHoverBorder"></span></a></li>' 666 }, 667 function(data) { 668 self.find(" a[data-lightbox='image']").magnificPopup({type:'image', tLoading: ''}); 669 self.parent().removeClass('loadingz'); 670 }); 671 } 672 }); 673 } 674 } 675// END Flickr Feed 676 677 678// Tonext button - Scrolls to next block (used for fullscreen slider) 679 if(typeof($(".js-tonext-btn")) != 'undefined'){ 680 $(".js-tonext-btn").on('click',function (e) { 681 e.preventDefault(); 682 var endof = $(this).attr('data-endof') ? $(this).attr('data-endof') : false, 683 dest = 0; 684 685 if ( endof ) 686 dest = $(endof).height() + $(endof).offset().top; 687 688 //go to destination 689 $('html,body').animate({scrollTop: dest}, 1000, 'easeOutExpo'); 690 }); 691 } 692// END Tonext button - Scrolls to next block (used for fullscreen slider) 693 694 695// Blog Isotope item 696 var enable_blog_isotope = function( scope ){ 697 var elements = scope.find( '.hg_blog_columns, .masonry-columns' ); 698 if( elements.length == 0) { return; } 699 700 if( typeof $.fn.imagesLoaded != 'undefined' && typeof $.fn.isotope != 'undefined' ) 701 { 702 elements.imagesLoaded( function() { 703 elements.isotope({ 704 itemSelector: ".blog-isotope-item, .item", 705 animationEngine: "jquery", 706 animationOptions: { 707 duration: 250, 708 easing: "easeOutExpo", 709 queue: false 710 }, 711 filter: '', 712 sortAscending: true, 713 sortBy: '' 714 }); 715 }); 716 } 717 }; 718 var blog_isotope = $('.hg_blog_archive_element, .portfolio-masonry'); 719 if(blog_isotope){ 720 enable_blog_isotope ( blog_isotope ); 721 } 722// END Blog Isotope item 723 724 725// Price Filter 726 var priceRange = $( ".price-range-slider" ); 727 if(typeof(priceRange) != 'undefined') { 728 $.each(priceRange, function(index, val) { 729 var _t = $(this), 730 priceResult = _t.parent().find(".price-result"), 731 currency = priceResult.data('currency'); 732 if( typeof($.fn.slider) != 'undefined' ){ 733 _t.slider({ 734 range: true, 735 min: 0, 736 max: 500, 737 values: [ 75, 300 ], 738 slide: function( event, ui ) { 739 priceResult.val( currency + ui.values[ 0 ] + " - "+ currency + ui.values[ 1 ] ); 740 } 741 }); 742 } 743 priceResult.val( currency + _t.slider( "values", 0 ) + " - " + currency + _t.slider( "values", 1 ) ); 744 }); 745 } 746// END Price Filter 747 748 749// Check portfolio content & Knowledgebase categories read more button 750 var elements = $('.portfolio-item-more-toggle, .kb-item-more-toggle'); 751 if(elements){ 752 $.each(elements, function(a,b){ 753 var element = $(b); 754 element.on('click', function(e){ 755 e.preventDefault(); 756 e.stopPropagation(); 757 var eTarget = element.parents('.portfolio-item-desc, .kb-category').first(); 758 eTarget.toggleClass('is-opened'); 759 }); 760 }); 761 } 762// END Check portfolio content & Knowledgebase categories read more button 763 764 765// Map toggle panel 766 elements = $('.kl-contentmaps__panel-tgg'); 767 if(elements){ 768 elements.each(function(a, b){ 769 var element = $(b); 770 element.on('click', function(e){ 771 e.preventDefault(); 772 e.stopPropagation(); 773 var targetElement = $(element.data('target')); 774 if(targetElement){ 775 var toggleClass = element.data('targetClass'); 776 if(toggleClass){ 777 targetElement.toggleClass(toggleClass); 778 } 779 } 780 }); 781 }); 782 } 783// END Map toggle panel 784 785 786// Stage icon boxes element - .kl-ib-point-active => activates the dot (see :hover) 787 elements = $('.kl-iconbox'); 788 if(elements){ 789 $.each(elements, function(a,b){ 790 var element = $(b), 791 target = $(element.data('targetElement')); // data-target-element="kl-ib-point-1" 792 if(target){ 793 element.on('mouseenter', function(e){ 794 target.addClass('kl-ib-point-active'); 795 }).on('mouseleave', function(){ 796 target.removeClass('kl-ib-point-active'); 797 }); 798 } 799 }); 800 } 801// END Stage icon boxes element 802 803 804// MailChimp working newsletter 805// read more http://stackoverflow.com/a/15120409/477958 806 function register($form) { 807 if(! $form){ 808 return false;
809 } 810 $.ajax({ 811 type: $form.attr('method'), 812 url: $form.attr('action'), 813 data: $form.serialize(), 814 cache : false, 815 dataType : 'json', 816 contentType: "application/json; charset=utf-8", 817 error : function(err) { 818 var themessage = $('<span class="alert alert-danger"><button type="button" class="close icon-close" data-dismiss="alert" aria-hidden="true"></button>Could not connect to server. Please try again later.</span>'); 819 $('#notification_container').html(themessage); 820 setTimeout(function(){ 821 themessage.addClass('animate'); 822 }, 300) 823 }, 824 success : function(data) { 825 if (data.result != "success") { 826 var message = data.msg.substring(4), 827 themessage = $('<span class="alert alert-warning"><button type="button" class="close icon-close" data-dismiss="alert" aria-hidden="true"></button>'+message+'</span>'); 828 $('#notification_container').html(themessage); 829 setTimeout(function(){ 830 themessage.addClass('animate'); 831 }, 300); 832 } 833 else { 834 var message = data.msg, 835 themessage = $('<span class="success alert alert-success"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>'+message+'</span>'); 836 $('#notification_container').html(themessage); 837 setTimeout(function(){ 838 themessage.addClass('animate'); 839 }, 300) 840 } 841 } 842 }); 843 } 844 845 var $form = $('#mc-embedded-subscribe-form'); 846 if($form){ 847 $('#mc-embedded-subscribe-form').on('click', function(event) { 848 if(event) event.preventDefault(); 849 register($form); 850 }); 851 } 852 853 var $form_pop = $('#mc-embedded-subscribe-form-pop'); 854 if($form_pop){ 855 $('#mc-embedded-subscribe-form-pop').on('click', function(event) { 856 if(event) event.preventDefault(); 857 register($form_pop); 858 }); 859 } 860// END MailChimp working newsletter 861 862 863// Words play 864 jQuery('#textplay .textplay-line').each(function(index, el) { 865 var words = jQuery(el).children('.textplay-word'), 866 randlast; 867 setInterval(function(){ 868 var rand = Math.floor( (Math.random() * words.length) ); 869 if(rand == randlast) 870 rand = Math.floor( (Math.random() * words.length) ); 871 words.removeClass('active'); 872 setTimeout(function(){ 873 words.eq( rand ).addClass('active'); 874 },300); 875 randlast = rand; 876 }, 3000); 877 }); 878// END Words play 879 880 881// Sub-header mask effect 882 if (matchMedia('only screen and (min-width: 767px)').matches && $html.hasClass('js')){ 883 var scrollSvg = $('.kl-slideshow, #page_header'); 884 if( scrollSvg && scrollSvg.length > 0 ) 885 { 886 var scrollSvgHeight = (parseFloat(scrollSvg.css('height')) + 20), 887 svgEffect = scrollSvg.find('.screffect'); 888 $window.scroll(function(){ 889 var scrollPos = $window.scrollTop(); 890 if(scrollPos < scrollSvgHeight) { 891 var maxSkew = 2; 892 var effectPos = (maxSkew / scrollSvgHeight) * scrollPos; 893 svgEffect.css({ '-webkit-transform': 'skewY(-'+ effectPos +'deg)', 'transform': 'skewY(-'+ effectPos +'deg)' }); 894 } 895 }); 896 } 897 } 898// END Sub-header mask effect 899 900 901// Bubble Boxes 902 $('.bubble-box').each(function(index, el) { 903 var $el = $(el), 904 $revealAt = $el.attr('data-reveal-at'), 905 $hideAfter = $el.attr('data-hide-after'), 906 defaultRevealAt = 1000; // default reveal when scrolling is at xx px 907 if(typeof $revealAt == 'undefined' && $revealAt.length <= 0) $revealAt = defaultRevealAt; 908 $window.smartscroll(function(event) { 909 // reveal the popup 910 if ($el.length > 0 && $(window).scrollTop() > $revealAt && (!$el.hasClass('bb--anim-show') && !$el.hasClass('bb--anim-hide'))){ 911 $el.addClass("bb--anim-show"); 912 // check if hide after is defined and hide the popupbox 913 if(typeof $hideAfter != 'undefined' && $hideAfter.length >= 0) { 914 setTimeout(function(){ 915 $el.removeClass('bb--anim-show').addClass('bb--anim-hide').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', 916 function() { 917 $(this).remove(); 918 }); 919 }, $hideAfter) 920 } 921 } 922 }); 923 $el.find('.bb--close').on('click', function(){ 924 $el.addClass('bb--anim-hide').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', 925 function() { 926 $(this).remove(); 927 }); 928 }); 929 930 }); 931// END Bubble Boxes 932 933 934// Popup Box 935// Works with Magnific popup to open them
936// data-ppbox-timeout attribute needed to specify the timeout to appear 937 if(typeof($('.kl-pp-box[data-ppbox-timeout]')) != 'undefined') { 938 $('.kl-pp-box[data-ppbox-timeout]').each(function(index, el) { 939 var $el = $(el), 940 pptimeout = $el.attr('data-ppbox-timeout'), 941 timeout = (typeof pptimeout == 'undefined' && $(pptimeout).length <= 0) ? pptimeout : 8000; 942 943 var cookieExpireAttr = $el.attr('data-cookie-expire'), 944 cookieExpire = (typeof cookieExpireAttr !== 'undefined') ? cookieExpireAttr : 2; 945 946 // Remove cookie if you want to test 947 // $.removeCookie('ppbox', { path: '/' }); 948 949 // check if cookie exists 950 if(!$.cookie('ppbox')) { 951 // show the popupbox 952 var timer = setTimeout(function(){ 953 $.magnificPopup.open({ 954 items: { 955 src: $($el.get(0)) 956 }, 957 type: 'inline', 958 mainClass: 'mfp-fade mfp-bg-lighter', 959 tLoading: '' 960 }); 961 }, timeout); 962 } 963 // Set cookie and close popup 964 $(el).find('.dontshow').on('click',function(e){ 965 e.preventDefault(); 966 // Add cookie support 967 $.cookie('ppbox', 'hideit', { expires: parseInt(cookieExpire), path: '/' }); 968 //Close Popup 969 $.magnificPopup.close(); 970 }); 971 }); 972 } 973// END Popup Box 974 975 976// Login pop-up element & Contact form pop-up element 977 if(typeof($('.popup-with-form, .kl-cta-ribbon')) != 'undefined') { 978 $('.popup-with-form, .kl-cta-ribbon').magnificPopup({ 979 closeBtnInside: true, 980 type: 'inline', 981 preloader: false, 982 focus: '#name', 983 // When elemened is focused, some mobile browsers in some cases zoom in 984 // It looks not nice, so we disable it: 985 callbacks: { 986 beforeOpen: function() { 987 if ($(window).width() < 700) { 988 this.st.focus = false; 989 } else { 990 this.st.focus = '#name'; 991 } 992 } 993 } 994 }); 995 } 996// END Login pop-up element & Contact form pop-up element 997 998 999// Tooltips 1000// ** for more details how to use tooltips, you can check bootstrap documentation: http://getbootstrap.com/javascript/#tooltips 1001 if(typeof($.fn.tooltip) != 'undefined' && typeof($('[data-toggle="tooltip"]')) != 'undefined') { 1002 $('[data-toggle="tooltip"]').tooltip(); 1003 } 1004// END Tooltips 1005 1006 1007// Hover buttons icons in action bar 1008 jQuery(".cms-hov-icon").each(function(index, el) { 1009 var $el = jQuery(el), 1010 hovIcon = $el.attr('data-hovicon'); 1011 $el.on('mouseover', function(){ 1012 jQuery("#"+ hovIcon).addClass('hovered'); 1013 jQuery("#cms-icon-github-circled").removeClass('hovered'); 1014 }).on('mouseout', function(){ 1015 jQuery("#"+ hovIcon).removeClass('hovered'); 1016 jQuery("#cms-icon-github-circled").addClass('hovered'); 1017 }); 1018 }); 1019// END Hover buttons icons in action bar 1020 1021 1022// Appear Events 1023 if($.fn.appear != 'undefined') { 1024 $('[data-animated], .appear').appear({force_process: true}); 1025 1026 $('[data-animated="fade"]').on('appear', function() { 1027 $(this).each(function(i,el){ $(el).addClass('fade-animation') }); 1028 }); 1029 $('[data-animated="execute"]').on('appear', function() { 1030 $(this).each(function(i,el){ $(el).addClass('started') }); 1031 }); 1032 } 1033// end Appear Events 1034 1035 1036// // Tweets in Footer 1037// /* ### HOW TO CREATE A VALID ID: ### 1038// * Go to www.twitter.com and sign in as normal, go to your settings page. 1039// * Go to Widgets on the left hand side. 1040// * Create a new widget for what you need eg user timeline or search etc. 1041// * Feel free to check exclude replies if you dont want replies in results. 1042// * Now go back to settings page, and then go back to widgets page, you should 1043// * see the widget you just created. Click edit. 1044// * Now look at the URL in your web browser, you will see a long number like this: 1045// * 345735908357048478 1046// * Use this as your ID below instead! 1047 var twFeed = $('#twitterFeed'); 1048 if(twFeed.length > 0 && typeof(twitterFetcher) != 'undefined') { 1049 var handleTweets = function(tweets) { 1050 var x = tweets.length, 1051 element = document.getElementById('twitterFeed'), 1052 n = 0, 1053 html = '<ul>'; 1054 while(n < x) { 1055 html += '<li>' + tweets[n] + '</li>'; 1056 n++; 1057 } 1058 html += '</ul>'; 1059 element.innerHTML = html; 1060 } 1061 var twitter_config = { 1062 "id": '435730856443797504', 1063 "domId": '', 1064 "maxTweets": 1, 1065 "enableLinks": true, 1066 "showUser": false, 1067 "showTime": true, 1068 "dateFunction": '', 1069 "showRetweet": false, 1070 "customCallback": handleTweets, 1071 "showInteraction": false 1072 }; 1073 twitterFetcher.fetch(twitter_config); 1074 } 1075// END Tweets in Footer 1076 1077
1078/**** Initialize carousels based on CarouFredSel 1079 * .caroufredsel class mandatory 1080 * data-setup attribute needed (please find examples within the site) 1081 * */ 1082 var initCarouFredSels = function(dom){ 1083 // check if dom param is added, if not use $body 1084 dom = typeof dom !== 'undefined' ? dom : $body; 1085 // start carousel trigger with options 1086 var cfs_container = $(dom).find(".caroufredsel:not(.custom)"); 1087 // check if element exists so it can begin the job 1088 if (!cfs_container.length) return; 1089 // iterate through finds 1090 $.each( cfs_container, function(index, el) { 1091 var _el = $(el), 1092 _data_attribs = _el.attr("data-setup"), 1093 _options = typeof _data_attribs != 'undefined' ? JSON.parse(_data_attribs) : '{}', 1094 _nav = $('<div class="cfs--navigation"><a href="#" class="cfs--prev"></a><a href="#" class="cfs--next"></a></div>'), 1095 _pag = $('<div class="cfs--pagination"></div>'), 1096 _cfParent = _el.closest('.caroufredsel').parent(); 1097 1098 if(_options.navigation) 1099 ( _options.appendToParent ? _cfParent : _el ).append(_nav); 1100 1101 if(_options.pagination) 1102 ( _options.appendToParent ? _cfParent : _el ).append(_pag); 1103 1104 if(_options.swipe_touch || _options.swipe_mouse) 1105 _el.addClass('stl-swiper'); 1106 1107 var doCarouFredSels = function(){ 1108 _el.children('ul.slides').carouFredSel({ 1109 responsive: _options.hasOwnProperty('responsive') ? _options.responsive : true, 1110 width: _options.hasOwnProperty('width') ? _options.width : null, 1111 height: _options.hasOwnProperty('height') ? _options.height : null, 1112 align: _options.hasOwnProperty('align') ? _options.align : 'left', 1113 scroll: { 1114 items: _options.hasOwnProperty('scroll') ? _options.scroll : 1, 1115 fx : _options.hasOwnProperty('fx') ? _options.fx : "scroll" 1116 }, 1117 items: { 1118 visible: _options.hasOwnProperty('items') ? _options.items : 1, 1119 minimum: _options.hasOwnProperty('items_minimum') ? _options.items_minimum : 1, 1120 start: _options.hasOwnProperty('items_start') ? _options.items_start : 0, 1121 width:_options.hasOwnProperty('items_width') ? _options.items_width : null, 1122 height: _options.hasOwnProperty('items_height') ? _options.items_height : null 1123 }, 1124 auto: { 1125 play: _options.hasOwnProperty('autoplay') ? _options.autoplay : true, 1126 timeoutDuration: _options.hasOwnProperty('auto_duration') ? _options.auto_duration : 10000 1127 }, 1128 prev : { 1129 button : ( _options.appendToParent ? _cfParent : _el.closest('.caroufredsel') ).find('.cfs--prev'), 1130 key : "left" 1131 }, 1132 next : { 1133 button : ( _options.appendToParent ? _cfParent : _el.closest('.caroufredsel') ).find('.cfs--next'), 1134 key : "right" 1135 }, 1136 pagination: { 1137 container: ( _options.appendToParent ? _cfParent : _el.closest('.caroufredsel') ).find('.cfs--pagination'), 1138 anchorBuilder: function(nr, item) { 1139 return '<a href="#'+nr+'"></a>'; 1140 } 1141 }, 1142 swipe: { 1143 onTouch: _options.hasOwnProperty('swipe_touch') || Modernizr.touch ? _options.swipe_touch : false, 1144 onMouse: _options.hasOwnProperty('swipe_mouse') || Modernizr.touch ? _options.swipe_mouse : false 1145 } 1146 }); 1147 }; 1148 1149 cfs_container.imagesLoaded(doCarouFredSels); 1150 1151 }); 1152 }; 1153// end Initialize carousels based on CarouFredSel 1154 1155 1156/* Photo Gallery Alternative - Caroufredsel */ 1157 if($.fn.carouFredSel != 'undefined') { 1158 1159 /* Caroufredsel Trigger with options */ 1160 initCarouFredSels(); 1161 1162 /** 1163 * PhotoGallery Widget */ 1164 1165 1166 $('.photogallery-widget .caroufredsel').each(function(index, el) { 1167 1168 var _cfs_main = $(el), 1169 _cfs_main_slides = _cfs_main.children('ul.slides'); 1170 1171 _cfs_main_slides.children('li').slice(10).remove(); 1172 1173 var updPhotoGalWdgtCounter = function(c) { 1174 var cfscounter = c.closest('.caroufredsel').find('.cfs-counter'), 1175 current = c.triggerHandler( 'currentPosition' ); 1176 cfscounter.html( ( current+1 ) +" of "+ c.children().length ); 1177 }, 1178 doPhotoGalWdgt = function (){ 1179 _cfs_main_slides.carouFredSel({ 1180 responsive: true, 1181 width: 850, 1182 items: 1, 1183 auto: 10000, 1184 prev : { 1185 button : _cfs_main.find('.cfs--prev'), 1186 key : "left" 1187 }, 1188 next : { 1189 button : _cfs_main.find('.cfs--next'), 1190 key : "right" 1191 }, 1192 scroll: { 1193 fx: 'crossfade', 1194 onBefore: function( data ) { 1195 updPhotoGalWdgtCounter( _cfs_main_slides ); 1196 } 1197 }, 1198 onCreate: function( data ) { 1199 updPhotoGalWdgtCounter( _cfs_main_slides ); 1200 }, 1201 pagination: { 1202 container: _cfs_main.next('.cfs--pagination'), 1203 anchorBuilder: function(nr, item) { 1204 var th = _cfs_main.height()/5, 1205 ths = _cfs_main_slides.children('li'), 1206 thbg = ths.eq(nr-1).attr('data-thumb'), 1207 thdesc = ths.eq(nr-1).find('.pg-caption'), 1208 thdesc_html = thdesc.length > 0 ? thdesc.get(0).outerHTML : ''; 1209 return '<div class="pg-thumb" style="height: '+th+'px"><a href="#'+nr+'" style="background-image:url('+thbg+');"></a>'+ thdesc_html +'</div>'; 1210 } 1211 }, 1212 swipe: { 1213 onTouch: Modernizr.touch ? true : false, 1214 onMouse: Modernizr.touch ? true : false 1215 } 1216 }); 1217 } 1218 // append pagination 1219 _cfs_main.after('<div class="cfs--pagination"></div>'); 1220 // Load Carousel after images are loaded 1221 _cfs_main.imagesLoaded(doPhotoGalWdgt); 1222 1223 }); 1224 1225 } // end checking if carouFredSel is loaded
1226/* end Photo Gallery Alternative - Caroufredsel */ 1227 1228 1229// Chart animation based on easyPieChart jQuery plugin 1230 if($.fn.appear != 'undefined' && $.fn.easyPieChart != 'undefined') { 1231 var chart = $(".fundedperc .chart"); 1232 chart.appear(); 1233 $(document.body).on('appear', '.fundedperc .chart', function() { 1234 jQuery('.chart').easyPieChart({ 1235 animate: 2000, 1236 barColor : typeof chart.attr('data-color') != 'undefined' ? chart.attr('data-color') : '#CD2122', 1237 trackColor: false, 1238 lineWidth: 16, 1239 size: 300, 1240 lineCap: 'square', 1241 scaleLength: 0, 1242 onStep: function(from, to, percent) { 1243 $(this.el).find('.percent span').text( Math.round(percent)); 1244 } 1245 }); 1246 }); 1247 } 1248// end Chart animation based on easyPieChart jQuery plugin 1249 1250 1251// Process items: make the line behind the elements 1252 var selectors = $(".processitems li"); 1253 if( selectors && selectors.length > 0) 1254 { 1255 $(".processitems li").each(function(i,el) { 1256 $(el).on({ 1257 'mouseenter':function(){ 1258 $(this).prevAll().each(function() { 1259 $(this).addClass("lined"); 1260 }); 1261 }, 1262 'mouseleave':function(){ 1263 $(this).siblings().each(function() { 1264 $(this).removeClass("lined"); 1265 }); 1266 }}); 1267 }); 1268 } 1269// end Process items: make the line behind the elements 1270 1271 1272// Circular carousel element more buttom function 1273 var selectors = $('.ca-container .ca-wrapper'); 1274 if( selectors && selectors.length > 0) 1275 { 1276 selectors.each(function(i, el){ 1277 1278 var self = $(el); 1279 1280 // Open wrapper panel 1281 var opened = false; 1282 self.find('.js-ca-more').on('click', function(e){ 1283 e.preventDefault(); 1284 var th = $(this).closest('.ca-item'), 1285 thpos = th.position().left; 1286 1287 if(!opened){ 1288 self.slick('slickPause'); 1289 self.closest('.ca-container').addClass('ca--is-rolling'); 1290 th.addClass('ca--opened'); 1291 1292 var activeItems = self.find('.ca-item.slick-active'), 1293 openedIndex = activeItems.index( th ), 1294 moveTo = (self.width() / activeItems.length) * openedIndex; 1295 1296 th.css({ 1297 "-webkit-transform":"translateX(-"+ moveTo +"px)", 1298 "-ms-transform":"translateX(-"+ moveTo +"px)", 1299 "transform":"translateX(-"+ moveTo +"px)" 1300 }); 1301 opened = true; 1302 1303 } else if(opened){ 1304 1305 if($(this).hasClass('js-ca-more-close')){ 1306 1307 self.slick('slickPlay', true); 1308 self.closest('.ca-container').removeClass('ca--is-rolling'); 1309 th.removeClass('ca--opened'); 1310 th.css({ 1311 "-webkit-transform":"translateX(0)", 1312 "-ms-transform":"translateX(0)", 1313 "transform":"translateX(0)" 1314 }); 1315 opened = false; 1316 } 1317 } 1318 }); 1319 // Close wrapper panel 1320 self.find('.js-ca-close').on('click', function(e){ 1321 e.preventDefault(); 1322 var th = $(this).closest('.ca-item'); 1323 if(opened){ 1324 self.slick('slickPlay', true); 1325 self.closest('.ca-container').removeClass('ca--is-rolling'); 1326 th.removeClass('ca--opened'); 1327 th.css({ 1328 "-webkit-transform":"translateX(0)", 1329 "-ms-transform":"translateX(0)", 1330 "transform":"translateX(0)" 1331 }); 1332 } 1333 opened = false; 1334 }); 1335 }); 1336 } 1337// end Circular carousel element more buttom function 1338 1339 1340})(window.jQuery, window, document); 1341 1342 1343// ScollSpy One page Menu 1344if(KallyasConfig.enableScrollSpy){ 1345 //#! [Configure ScrollSpy] Set the attribute on body 1346 $(window).on('load scroll resize', function(){ 1347 var bodyScrollSpy = $('body[data-spy="scroll"]'); 1348 if(KallyasConfig.enableChaserMenu && $(window).scrollTop() > KallyasConfig.chaserMenuOffsetDisplay ) { 1349 bodyScrollSpy.attr('data-target', '#wpk-main-menu'); 1350 } 1351 else { 1352 bodyScrollSpy.attr('data-target', '#main-menu'); 1353 } 1354 }); 1355 1356 jQuery(function($){ 1357 var bodyScrollSpy = $('body') 1358 bodyScrollSpy 1359 .css('position', 'relative') 1360 .attr('data-spy', 'scroll') 1361 .attr('data-offset', '5'); 1362 1363 // OnLoad 1364 var hash = window.location.hash; 1365 if(hash){ 1366 // check the main menu first 1367 var targets = $('#menu-main-menu > li > a'); 1368 $.each(targets, function(a,b){ 1369 if( hash == $(b).attr('href')){ 1370 $(b).parents('ul').first().find('*').removeClass('active'); 1371 $(b).addClass('active'); 1372 $(hash).attr('tabindex', '-1'); 1373 $(hash).focus(); 1374 } 1375 }); 1376 } 1377 // Menu item OnClick 1378 $('#menu-main-menu > li > a, .chaser li a').on('click',function(e) { 1379 var item = $(this); 1380 if(! item.hasClass('active')) { 1381 item.parents('ul').find('*').removeClass('active'); 1382 item.addClass('active'); 1383 } 1384 }); 1385 }); 1386} 1387// end ScollSpy One page Menu
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.