1(function($) { 2 3 $(document).ready(function() { 4 5 /*-----------------------------------------------------------------------------------*/ 6 /* FEATURED GRID SLIDER 7 /*-----------------------------------------------------------------------------------*/ 8 if (parseInt(vce_js_settings.rtl_mode) == 1) { 9 vce_js_settings.rtl_mode = true; 10 } else { 11 vce_js_settings.rtl_mode = false; 12 } 13 14 $("#vce-featured-grid").owlCarousel({ 15 margin: 1, 16 loop: true, 17 rtl: vce_js_settings.rtl_mode, 18 autoplay: vce_js_settings.grid_slider_autoplay, 19 autoplaySpeed: 500, 20 autoplayTimeout: vce_js_settings.grid_slider_autoplay, 21 nav: true, 22 center: true, 23 fluidSpeed: 100, 24 items: 3, 25 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 26 responsive: { 27 0: { 28 items: 1, 29 nav: true, 30 autoWidth: true 31 }, 32 600: { 33 items: 2, 34 autoWidth: true 35 }, 36 768: { 37 items: 3, 38 autoWidth: false 39 }, 40 1024: { 41 items: 3, 42 autoWidth: true 43 } 44 } 45 }); 46 47 $(".vce-featured-full-slider").owlCarousel({ 48 loop: true, 49 nav: true, 50 rtl: vce_js_settings.rtl_mode, 51 autoplay: vce_js_settings.full_slider_autoplay, 52 autoplaySpeed: 500, 53 autoplayTimeout: vce_js_settings.full_slider_autoplay, 54 center: true, 55 items: 1, 56 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'] 57 }); 58 59 $('.vce-post-slider').owlCarousel({ 60 loop: true, 61 nav: true, 62 rtl: vce_js_settings.rtl_mode, 63 center: true, 64 fluidSpeed: 100, 65 items: 1, 66 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'] 67 }); 68 69 /*-----------------------------------------------------------------------------------*/ 70 /* MAGNIFIC POPUP 71 /*-----------------------------------------------------------------------------------*/ 72 73 if ($('.vce-image-format').length) { 74 $('.vce-image-format').magnificPopup({ 75 type: 'image', 76 zoom: { 77 enabled: true, 78 duration: 300, // don't foget to change the duration also in CSS 79 opener: function(element) { 80 return element.find('img'); 81 } 82 } 83 }); 84 } 85 86 if ($('.vce-gallery-big').length) { 87 $('.vce-gallery-big').magnificPopup({ 88 type: 'image', 89 delegate: 'a', 90 gallery: { 91 enabled: true 92 }, 93 zoom: { 94 enabled: true, 95 duration: 300, // don't foget to change the duration also in CSS 96 opener: function(element) { 97 return element.find('img'); 98 } 99 }, 100 image: { 101 titleSrc: function(item) { 102 var $caption = item.el.closest('.big-gallery-item').find('.gallery-caption'); 103 if ($caption != 'undefined') { 104 return $caption.text(); 105 } 106 return ''; 107 } 108 } 109 }); 110 } 111 112 $('body').on('click', '.vce-gallery-slider a', function(e) { 113 e.preventDefault(); 114 var item_id = $(this).closest('.gallery-item').attr('data-item'); 115 var $wrap = $(this).closest('.gallery'); 116 var $big = $wrap.find('.vce-gallery-big'); 117 $big.find('.big-gallery-item').fadeOut(400); 118 $big.find('.item-' + item_id).fadeIn(400); 119 120 }); 121 122 123 124 125 /*-----------------------------------------------------------------------------------*/ 126 /* GALLERY POST SLIDER 127 /*-----------------------------------------------------------------------------------*/ 128 129
130 $('.gallery .vce-gallery-slider').each(function() { 131 $(this).owlCarousel({ 132 margin: 1, 133 loop: true, 134 rtl: vce_js_settings.rtl_mode, 135 nav: true, 136 mouseDrag: false, 137 center: false, 138 fluidSpeed: 100, 139 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 140 items: $(this).attr('data-columns'), 141 autoWidth: false 142 }); 143 }); 144 145 146 /*-----------------------------------------------------------------------------------*/ 147 /* MODULE SLIDERS 148 /*-----------------------------------------------------------------------------------*/ 149 150 if ($("body").hasClass('vce-sid-none')) { 151 var vce_slider_items_num = { 152 'b': 2, 153 'cdf': 3, 154 'e': 7 155 }; 156 } else { 157 var vce_slider_items_num = { 158 'b': 1, 159 'cdf': 2, 160 'e': 5 161 }; 162 } 163 164 $(".vce-slider-pagination.vce-slider-a, .vce-slider-pagination.vce-slider-g").each(function() { 165 166 var vce_autoplay; 167 vce_autoplay = $(this).attr('data-autoplay'); 168 169 $(this).owlCarousel({ 170 loop: true, 171 autoHeight: false, 172 rtl: vce_js_settings.rtl_mode, 173 autoWidth: true, 174 nav: true, 175 autoplay: vce_autoplay, 176 autoplaySpeed: 500, 177 autoplayTimeout: vce_autoplay, 178 fluidSpeed: 100, 179 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 180 responsive: { 181 0: { 182 items: 1, 183 nav: true, 184 autoWidth: false, 185 margin: 10 186 }, 187 600: { 188 items: 1, 189 autoWidth: false 190 }, 191 768: { 192 items: 1, 193 margin: 20, 194 autoWidth: false 195 }, 196 1023: { 197 items: 1, 198 autoWidth: false, 199 margin: 20, 200 } 201 } 202 }); 203 }); 204 205 206 207 $(".vce-slider-pagination.vce-slider-b").each(function() { 208 209 var vce_autoplay; 210 vce_autoplay = $(this).attr('data-autoplay'); 211 212 $(this).owlCarousel({ 213 loop: true, 214 autoHeight: false, 215 autoWidth: true, 216 rtl: vce_js_settings.rtl_mode, 217 nav: true, 218 fluidSpeed: 100, 219 autoplay: vce_autoplay, 220 autoplaySpeed: 500, 221 autoplayTimeout: vce_autoplay, 222 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 223 responsive: { 224 0: { 225 items: 1, 226 nav: true, 227 autoWidth: false, 228 margin: 10 229 }, 230 600: { 231 items: 1, 232 autoWidth: false 233 }, 234 768: { 235 items: 1, 236 margin: 20, 237 autoWidth: false 238 }, 239 1023: { 240 items: vce_slider_items_num.b, 241 autoWidth: false, 242 margin: 20, 243 } 244 } 245 }); 246 }); 247 248 $(".vce-slider-pagination.vce-slider-c, .vce-slider-pagination.vce-slider-d, .vce-slider-pagination.vce-slider-f").each(function() { 249 var vce_num_items; 250 var vce_res_num_items; 251 if ($(this).parent().parent().hasClass('main-box-half')) { 252 vce_num_items = 1; 253 vce_res_num_items = 1; 254 } else { 255 vce_num_items = vce_slider_items_num.cdf; 256 vce_res_num_items = 2; 257 } 258 259 var vce_autoplay; 260 vce_autoplay = $(this).attr('data-autoplay'); 261 262 $(this).owlCarousel({ 263 loop: true, 264 autoHeight: false, 265 rtl: vce_js_settings.rtl_mode, 266 autoWidth: true, 267 nav: true, 268 fluidSpeed: 100, 269 autoplay: vce_autoplay, 270 autoplaySpeed: 500, 271 autoplayTimeout: vce_autoplay, 272 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 273 responsive: { 274 0: { 275 items: 1, 276 nav: true, 277 autoWidth: false, 278 margin: 10 279 }, 280 600: { 281 items: vce_res_num_items, 282 margin: 18, 283 autoWidth: false 284 }, 285 768: { 286 items: vce_res_num_items, 287 margin: 15, 288 autoWidth: false 289 }, 290 1023: { 291 items: vce_num_items, 292 autoWidth: false, 293 margin: 19, 294 } 295 } 296 }); 297 }); 298 299 var vce_autoplay; 300 vce_autoplay = $(this).attr('data-autoplay'); 301 302 $(".vce-slider-pagination.vce-slider-e").each(function() { 303 var vce_autoplay; 304 vce_autoplay = $(this).attr('data-autoplay'); 305 306 $(this).owlCarousel({ 307 loop: true, 308 autoHeight: false, 309 autoWidth: true, 310 rtl: vce_js_settings.rtl_mode, 311 nav: true, 312 fluidSpeed: 100, 313 autoplay: vce_autoplay, 314 autoplaySpeed: 500, 315 autoplayTimeout: vce_autoplay, 316 navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 317 responsive: { 318 0: { 319 items: 2, 320 nav: true, 321 autoWidth: false, 322 margin: 5 323 }, 324 600: { 325 items: 3, 326 margin: 18, 327 autoWidth: false 328 }, 329 768: { 330 items: 5, 331 margin: 15, 332 autoWidth: false 333 }, 334 1023: { 335 items: vce_slider_items_num.e, 336 autoWidth: false, 337 margin: 19, 338 } 339 } 340 }); 341 }); 342 343 344 /*-----------------------------------------------------------------------------------*/ 345 /* STICKY SIDEBAR 346 /*-----------------------------------------------------------------------------------*/ 347 348 function sticky_sidebar() { 349 if ($(window).width() > 1024) { 350 if ($('.vce-sticky').length > 0) { 351 if ($('.vce-main-content').height() - 50 >
351 $('.sidebar').height()) { 352 353 var t = $('.vce-sticky').offset().top - 30; 354 355 if ($('body').hasClass('admin-bar')) { 356 var b = 0; 357 } else { 358 var b = 30; 359 } 360 361 if ($('.vce-content-bottom .vce-custom-content').length) { 362 var c = $('.vce-content-bottom .vce-custom-content').outerHeight() + 30; 363 } else { 364 var c = 0; 365 } 366 367 $(".vce-sticky").affix({ 368 offset: { 369 top: function() { 370 return t; 371 }, 372 bottom: function() { 373 return ($(".vce-sticky").hasClass("affix-top")) ? 0 : b; 374 } 375 } 376 }); 377 } 378 } 379 } 380 } 381 $('.vce-main-content').imagesLoaded().always(function(instance) { 382 sticky_sidebar(); 383 }); 384 385 $('body').on('keydown', function(e) { 386 if (e.which == 35) { 387 $(this).click(); 388 } 389 if (e.which == 36) { 390 $(this).click(); 391 } 392 }); 393 394 $(window).bind('resize', function() { 395 if ($(window).width() < 1024) { 396 $(".vce-sticky").addClass('affix-responsive'); 397 $('.sidebar.left').insertAfter('.vce-main-content'); 398 } else { 399 $('.sidebar.left').insertBefore('.vce-main-content'); 400 } 401 402 vce_logo(); 403 sticky_sidebar(); 404 405 //Center elements on resize 406 $('.vce-featured .vce-featured-info').each(function() { 407 $(this).vceCenter(); 408 }); 409 410 411 if (vce_js_settings.lay_fa_grid_center) { 412 $('#vce-featured-grid .vce-featured-info').each(function() { 413 $(this).vceCenter(); 414 }); 415 } 416 417 }); 418 419 //Put left sidebar after main content in responsive mode 420 if ($(window).width() < 1024 && $('.sidebar.left').length) { 421 $('.sidebar.left').insertAfter('.vce-main-content'); 422 } else { 423 $('.sidebar.left').insertBefore('.vce-main-content'); 424 } 425 426 /*-----------------------------------------------------------------------------------*/ 427 /* Fit videos 428 /*-----------------------------------------------------------------------------------*/ 429 430 $(".meta-media").fitVids(); 431 432 $(".vce-featured-header .vce-hover-effect").hover(function() { 433 $('.vce-featured-header .vce-featured-header-background').animate({ 434 opacity: vce_js_settings.fa_big_opacity[2] 435 }, 100); 436 }, function() { 437 $('.vce-featured-header .vce-featured-header-background').animate({ 438 opacity: vce_js_settings.fa_big_opacity[1] 439 }, 100); 440 }); 441 442 /*-----------------------------------------------------------------------------------*/ 443 /* Reverse submenu ul if out of the screen 444 /*-----------------------------------------------------------------------------------*/ 445 $('.nav-menu li').hover(function(e) { 446 if ($(this).closest('body').width() < $(document).width()) { 447 448 $(this).find('ul').addClass('vce-rev'); 449 } 450 }, function() { 451 $(this).find('ul').removeClass('vce-rev'); 452 }); 453 454 /*-----------------------------------------------------------------------------------*/ 455 /* Responsive navigation 456 /*-----------------------------------------------------------------------------------*/ 457 458 459 $('#vce-responsive-nav').sidr({ 460 name: 'sidr-main', 461 source: '#site-navigation', 462 speed: 100 463 }); 464 465 $("body").on('touchstart click', '.vce-responsive-nav', function(e) { 466 e.stopPropagation(); 467 e.preventDefault(); 468 if (!$(this).hasClass('nav-open')) { 469 $.sidr('open', 'sidr-main'); 470 $(this).addClass('nav-open'); 471 } else { 472 $.sidr('close', 'sidr-main'); 473 $(this).removeClass('nav-open'); 474 } 475 }); 476 477 $('#vce-main').on('click', function(e) { 478 if ($('body').hasClass('sidr-open')) { 479 $.sidr('close', 'sidr-main'); 480 $('.vce-responsive-nav').removeClass('nav-open'); 481 } 482 }); 483 484 $('.sidr ul li').each(function() { 485 if ($(this).hasClass('sidr-class-menu-item-has-children')) { 486 $(this).append('<span class="vce-menu-parent fa fa-angle-down"></span>') 487 } 488 }); 489 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 490 $('.vce-menu-parent').on('touchstart', function(e) { 491 $(this).prev().slideToggle(); 492 $(this).parent().toggleClass('sidr-class-current_page_item'); 493 }); 494 495 $('.soc_sharing').on('click', function() { 496 $(this).toggleClass('soc_active'); 497 }); 498 499 } else { 500 $('.vce-menu-parent').on('click', function(e) { 501 $(this).prev().slideToggle(); 502 $(this).parent().toggleClass('sidr-class-current_page_item'); 503 }); 504 } 505 506 /*-----------------------------------------------------------------------------------*/ 507 /* MATCH HEIGHT FOR LAYOUTS 508 /*-----------------------------------------------------------------------------------*/ 509 510 $('.vce-lay-c, .vce-sid-none .vce-lay-b, .vce-lay-d, .vce-lay-e').matchHeight(); 511 $('.vce-lay-f').matchHeight(false); 512 $('.main-box-half .main-box-inside .vce-loop-wrap').matchHeight(); 513 $('.main-box-half').matchHeight(); 514 515 /*-----------------------------------------------------------------------------------*/ 516 /* SCROLL TO COMMENTS 517 /*-----------------------------------------------------------------------------------*/ 518 $('.vce-single .entry-meta .comments a').click(function(e) { 519 e.preventDefault(); 520 var target = this.hash, 521 $target = $(target); 522 $('html, body').stop().animate({ 523 'scrollTop': $target.offset().top 524 }, 900, 'swing', function() { 525 window.location.hash = target; 526 }); 527 }); 528 529 /*-----------------------------------------------------------------------------------*/ 530 /* Load More Posts 531 /*-----------------------------------------------------------------------------------*/ 532 533 var vce_load_ajax_new_count = 0; 534 535 $("body").on('click', '.vce-load-more a', function(e) { 536 e.preventDefault(); 537 var $link = $(this); 538 var page_url = $link.attr("href"); 539 $link.addClass('vce-loader'); 540 $("<div>").load(page_url, function() { 541 var n = vce_load_ajax_new_count.toString(); 542 var $wrap = $link.closest('.main-box-inside').find('.vce-loop-wrap'); 543 var $new = $(this).find('.vce-loop-wrap .vce-post').addClass('vce-new-' + n); 544 var $this_div = $(this); 545 546 $new.imagesLoaded(function() { 547 548 $new.hide().appendTo($wrap).fadeIn(400); 549 550 if ($new.eq(0).is('.vce-lay-c, .vce-lay-b, .vce-lay-d, .vce-lay-e, .vce-lay-f')) { 551 // setTimeout(function() { 552 $.fn.matchHeight._apply('.vce-loop-wrap .vce-new-' + n, true); 553 //alert('ok'); 554 // }, 1000); 555 } 556 557 if ($this_div.find('.vce-load-more').length) { 558 $link.closest('.main-box-inside').find('.vce-load-more').html($this_div.find('.vce-load-more').html()); 559 } else { 560 $link.closest('.main-box-inside').find('.vce-load-more').fadeOut('fast').remove(); 561 } 562 563 if (page_url != window.location) { 564 window.history.pushState({ 565 path: page_url 566 }, '', page_url); 567 } 568 569 vce_load_ajax_new_count++; 570 571 return false; 572 }); 573 574 }); 575 576 }); 577 578 /*-----------------------------------------------------------------------------------*/ 579 /* Infinite scroll 580 /*-----------------------------------------------------------------------------------*/ 581 var vce_infinite_allow = true; 582 if ($('.vce-infinite-scroll').length) { 583 $(window).scroll(function() { 584 //console.log('top: ' + $(this).scrollTop()); 585 ///console.log('inf: ' + ( $('.vce-infinite-scroll').offset().top - $(this).height() ) ); 586 if (vce_infinite_allow && $('.vce-infinite-scroll').length && ($(this).scrollTop() > ($('.vce-infinite-scroll').offset().top) - $(this).height() - 200)) { 587 var $link = $('.vce-infinite-scroll a'); 588 var page_url = $link.attr("href"); 589 590 if (page_url != undefined) { 591 $link.parent().animate({ 592 opacity: 1, 593 height: 32 594 }, 300).css('padding', '20px'); 595 596 vce_infinite_allow = false; 597 598 $("<div>").load(page_url, function() { 599 600 var n = vce_load_ajax_new_count.toString(); 601 var $wrap = $link.closest('.main-box-inside').find('.vce-loop-wrap'); 602 var $new = $(this).find('.vce-loop-wrap .vce-post').addClass('vce-new-' + n); 603 var $this_div = $(this); 604 605 $new.imagesLoaded(function() { 606 $new.hide().appendTo($wrap).fadeIn(400); 607 608 if ($new.eq(0).is('.vce-lay-c, .vce-lay-b, .vce-lay-d, .vce-lay-e, .vce-lay-f')) { 609 setTimeout(function() { 610 $.fn.matchHeight._apply('.vce-loop-wrap .vce-new-' + n, true); 611 }, 1000); 612 } 613 614 if ($this_div.find('.vce-infinite-scroll').length) { 615 $link.closest('.main-box-inside').find('.vce-infinite-scroll').html($this_div.find('.vce-infinite-scroll').html()).animate({ 616 opacity: 0, 617 height: 0 618 }, 300).css('padding', '0'); 619 vce_infinite_allow = true; 620 } else { 621 $link.closest('.main-box-inside').find('.vce-infinite-scroll').fadeOut('fast').remove(); 622 } 623 624 625 if (page_url != window.location) { 626 window.history.pushState({ 627 path: page_url 628 }, '', page_url); 629 } 630 631 vce_load_ajax_new_count++; 632 633 return false; 634 }); 635 636 }); 637 } 638 } 639 }); 640 } 641 642 /*-----------------------------------------------------------------------------------*/ 643 /* ACCORDION MENU WIDGET 644 /*-----------------------------------------------------------------------------------*/
645 $('.widget_nav_menu .menu-item-has-children, .widget_pages .page_item_has_children').click(function() { 646 $(this).find('ul.sub-menu:first, ul.children:first').slideToggle('fast'); 647 648 }); 649 650 $('body').on("click", ".search_header", function() { 651 $(this).find('i').toggleClass('fa-times', 'fa-search'); 652 $(this).toggleClass('vce-item-selected'); 653 $(this).parent().toggleClass('vce-zoomed'); 654 $(this).next().find('.search-input').focus(); 655 }); 656 657 658 659 /*-----------------------------------------------------------------------------------*/ 660 /* BACK TO TOP 661 /*-----------------------------------------------------------------------------------*/ 662 $(window).scroll(function() { 663 if ($(this).scrollTop() > 400) { 664 $('#back-top').fadeIn(); 665 } else { 666 $('#back-top').fadeOut(); 667 } 668 }); 669 670 $('#back-top').click(function() { 671 $('body,html').animate({ 672 scrollTop: 0 673 }, 800); 674 return false; 675 }); 676 677 678 /*-----------------------------------------------------------------------------------*/ 679 /* Open popup on post share links 680 /*-----------------------------------------------------------------------------------*/ 681 $('body').on('click', 'ul.vce-share-items a', function(e) { 682 e.preventDefault(); 683 var data = $(this).attr('data-url'); 684 vce_social_share(data); 685 }); 686 687 function vce_social_share(data) { 688 window.open(data, "Share", 'height=500,width=760,top=' + ($(window).height() / 2 - 250) + ', left=' + ($(window).width() / 2 - 380) + 'resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0'); 689 } 690 691 692 /*-----------------------------------------------------------------------------------*/ 693 /* Mega menu 694 /*-----------------------------------------------------------------------------------*/ 695 696 $("#vce_main_navigation_menu li.vce-mega-cat").append('<ul class="vce-mega-menu-wrapper"></ul>'); 697 698 $('body').on("hover", "#vce_main_navigation_menu li.vce-mega-cat a", function() { 699 700 var $ul_wrap = $(this).parent().find('.vce-mega-menu-wrapper'); 701 702 if ($ul_wrap.is(':empty')) { 703 704 $ul_wrap.addClass('vce-loader'); 705 706 var data = { 707 action: 'vce_mega_menu', 708 cat: $(this).attr('data-mega_cat_id') 709 }; 710 711 $.post(vce_js_settings.ajax_url, data, function(response) { 712 if ($ul_wrap.is(':empty')) { 713 //$ul_wrap.append(response); 714 715 var $response = $($.parseHTML(response)); 716 717 $ul_wrap.removeClass('vce-loader'); 718 setTimeout(function() { 719 $.fn.matchHeight._apply('.vce-mega-menu-wrapper .mega-menu-link', true); 720 }, 300); 721 $response.hide().appendTo($ul_wrap).fadeIn(400); 722 } 723 }); 724 } 725 726 }); 727 728 /*-----------------------------------------------------------------------------------*/ 729 /* STICKY HEADER 730 /*-----------------------------------------------------------------------------------*/ 731 if (vce_js_settings.sticky_header) { 732 var sticky_header_created = false; 733 734 if ($('#header').length) { 735 736 var sticky_header_top = $('#header').offset().top + parseInt(vce_js_settings.sticky_header_offset); 737 // Hide Header on on scroll down 738 var didScroll; 739 var lastScrollTop = 0; 740 var delta = 5; 741 var navbarHeight = $('#header').outerHeight(); 742 var st = $(this).scrollTop(); 743 744 $(window).scroll(function() { 745 if ($(window).width() > 480) { 746 if ($(window).scrollTop() > sticky_header_top) { 747 if (sticky_header_created == false) { 748 cloneHeader(); 749 sticky_header_created = true; 750 setTimeout(function() { 751 $('body').addClass('sticky-active'); 752 $('#sticky_header').addClass('header-is-sticky'); 753 754 }, 300); 755 756 } else { 757 $('body').addClass('sticky-active'); 758 $('#sticky_header').addClass('header-is-sticky'); 759 } 760 761 } else { 762 $('body').removeClass('sticky-active'); 763 $('#sticky_header').removeClass('header-is-sticky'); 764 } 765 } else { 766 if (sticky_header_created == false) { 767 cloneHeader(); 768 sticky_header_created = true; 769 } else { 770 $('body').addClass('sticky-active'); 771 // $('#sticky_header').addClass('header-is-sticky'); 772 } 773 //call for hasScrolled() function 774 setInterval(); 775 } 776 777 }); 778 779 } 780 781 $(window).scroll(function() { 782 didScroll = true; 783 }); 784 785 function setInterval() { 786 if (didScroll) { 787 hasScrolled(); 788 didScroll = false; 789 } 790 } 791 792 793 function cloneHeader() { 794 var site_logo = $('.site-title').clone(true); 795 var site_nav = $('.main-navigation').clone(true, true); 796 var site_nav_res = $('.vce-res-nav').clone(true); 797 $('body').prepend('<div id="sticky_header" class="header-sticky"><div class="container">' + site_nav_res.html() + '<div class="site-title">' + site_logo.html() + '</div><div class="main-navigation">' + site_nav.html() + '</div></div></div>'); 798 if (vce_js_settings.sticky_header_logo != "" && $("#sticky_header .site-title a img").length > 0) { 799 $("#sticky_header .site-title a img").attr("src", vce_js_settings.sticky_header_logo); 800 } 801 $("#sticky_header .site-title a img").css('height', 'auto').css('width', 'auto'); 802 803 } 804 805 function hasScrolled() { 806 var st = $(this).scrollTop(); 807 808 if (Math.abs(lastScrollTop - st) <= delta) 809 return; 810 811 if (st > lastScrollTop) { 812 // Scroll Down 813 $('#sticky_header').removeClass('header-is-sticky'); 814 815 } else { 816 // Scroll Up
817 if (st < navbarHeight) { 818 $('#sticky_header').removeClass('header-is-sticky'); 819 } else { 820 $('#sticky_header').addClass('header-is-sticky'); 821 } 822 } 823 824 lastScrollTop = st; 825 } 826 827 } 828 //Our center function 829 $.fn.vceCenter = function() { 830 this.css("position", "absolute"); 831 this.css("top", ($(this).parent().height() - this.height()) / 2 + "px"); 832 return this; 833 } 834 835 /* Display nicely some areas when images are finished with loading */ 836 837 $('.vce-featured').imagesLoaded().always(function(instance) { 838 $('.vce-featured .vce-featured-info').each(function() { 839 $(this).vceCenter().animate({ 840 opacity: 1 841 }, 400); 842 }); 843 844 $('.vce-featured').animate({ 845 opacity: 1 846 }, 400); 847 }); 848 849 $('#vce-featured-grid').imagesLoaded().always(function(instance) { 850 851 if (vce_js_settings.lay_fa_grid_center) { 852 $('#vce-featured-grid .vce-featured-info').each(function() { 853 $(this).vceCenter(); 854 }); 855 } 856 857 $('#vce-featured-grid .vce-grid-item').animate({ 858 opacity: 1 859 }, 400); 860 }); 861 862 863 $('.vce-post-slider, .vce-post-big').imagesLoaded().always(function(instance) { 864 $('.vce-post-slider .vce-posts-wrap, .vce-post-big .vce-posts-wrap').each(function() { 865 $(this).vceCenter().animate({ 866 opacity: 1 867 }, 400); 868 }); 869 }); 870 871 //Logo init 872 vce_logo(); 873 874 875 876 877 }); //end document ready 878 879 880 /* Retina & responsive logo setup function */ 881 882 var vce_logo_width; 883 var vce_logo_height; 884 var vce_logo_height_res; 885 var vce_logo_width_res; 886 var vce_logo_init; 887 888 function vce_logo() { 889 if (vce_js_settings.logo_mobile != '' && $(window).width() < 1024 && $("#header .site-title img").length > 0) { 890 891 $('#header .site-title img').css("width", "initial"); 892 $('#header .site-title img').css("height", "initial"); 893 $("#header .site-title img").attr("src", vce_js_settings.logo_mobile); 894 if (vce_logo_init === undefined) { 895 vce_logo_init = 'mobile'; 896 } 897 898 } else if (vce_js_settings.logo_retina != "" && $("#header .site-title img").length > 0) { 899 var retina = window.devicePixelRatio > 1; 900 if (retina) { 901 $('#header .site-title').imagesLoaded().always(function(instance) { 902 903 if ($(window).width() > 1023) { 904 905 if (vce_logo_init === undefined) { 906 vce_logo_init = 'desktop'; 907 } 908 909 $('#header .site-title img').css("width", "initial"); 910 $('#header .site-title img').css("height", "initial"); 911 912 913 if (vce_logo_width === undefined) { 914 vce_logo_width = $('#header .site-title img').width(); 915 } 916 917 if (vce_logo_height === undefined) { 918 vce_logo_height = $('#header .site-title img').height(); 919 } 920 921 if (vce_logo_init == 'responsive') { 922 vce_logo_width = vce_logo_width / 2; 923 vce_logo_height = vce_logo_height / 2; 924 } 925 926 927 $('#header .site-title img').css("width", vce_logo_width); 928 $('#header .site-title img').css("height", vce_logo_height); 929 930 931 } else { 932 933 if (vce_logo_init === undefined) { 934 vce_logo_init = 'responsive'; 935 } 936 937 if (vce_logo_width_res === undefined) { 938 vce_logo_width_res = 'initial'; 939 } 940 941 if (vce_logo_height_res === undefined) { 942 vce_logo_height_res = $('#header .site-title img').height(); 943 } 944 945 $('#header .site-title img').css("width", vce_logo_width_res); 946 $('#header .site-title img').css("height", vce_logo_height_res); 947 } 948 949 $("#header .site-title img").attr("src", vce_js_settings.logo_retina); 950 }); 951 952 } 953 } 954 } 955 956 957 958})(jQuery);
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.