1 2// Theme 3window.theme = {}; 4 5// Theme Common Functions 6window.theme.fn = { 7 8 getOptions: function(opts) { 9 10 if (typeof(opts) == 'object') { 11 12 return opts; 13 14 } else if (typeof(opts) == 'string') { 15 16 try { 17 return JSON.parse(opts.replace(/'/g,'"').replace(';','')); 18 } catch(e) { 19 return {}; 20 } 21 22 } else { 23 24 return {}; 25 26 } 27 28 } 29 30}; 31 32// Animate 33(function(theme, $) { 34 35 theme = theme || {}; 36 37 var instanceName = '__animate'; 38 39 var PluginAnimate = function($el, opts) { 40 return this.initialize($el, opts); 41 }; 42 43 PluginAnimate.defaults = { 44 accX: 0, 45 accY: -80, 46 delay: 100, 47 duration: '750ms', 48 minWindowWidth: 320 49 }; 50 51 PluginAnimate.prototype = { 52 initialize: function($el, opts) { 53 if ($el.data(instanceName)) { 54 return this; 55 } 56 57 this.$el = $el; 58 59 this 60 .setData() 61 .setOptions(opts) 62 .build(); 63 64 return this; 65 }, 66 67 setData: function() { 68 this.$el.data(instanceName, this); 69 70 return this; 71 }, 72 73 setOptions: function(opts) { 74 this.options = $.extend(true, {}, PluginAnimate.defaults, opts, { 75 wrapper: this.$el 76 }); 77 78 return this; 79 }, 80 81 build: function() { 82 var self = this; 83 84 if($('body').hasClass('loading-overlay-showing')) { 85 $(window).on('loading.overlay.ready', function(){ 86 self.animate(); 87 }); 88 } else { 89 self.animate(); 90 } 91 92 return this; 93 }, 94 95 animate: function() { 96 var self = this, 97 $el = this.options.wrapper, 98 delay = 0, 99 duration = this.options.duration, 100 elTopDistance = $el.offset().top, 101 windowTopDistance = $(window).scrollTop(); 102 103 104 $el.addClass('appear-animation animated'); 105 106 if (!$('html').hasClass('no-csstransitions') && $(window).width() > self.options.minWindowWidth && elTopDistance >= windowTopDistance) { 107 108 $el.appear(function() { 109 110 $el.one('animation:show', function(ev) { 111 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 112 duration = ($el.attr('data-appear-animation-duration') ? $el.attr('data-appear-animation-duration') : self.options.duration); 113 114 115 if (duration != '750ms') { 116 $el.css('animation-duration', duration); 117 } 118 119 $el.css('animation-delay', delay + 'ms'); 120 121 $el.addClass($el.attr('data-appear-animation') + ' appear-animation-visible'); 122 }); 123 124 $el.trigger('animation:show'); 125 126 }, { 127 accX: self.options.accX, 128 accY: self.options.accY 129 }); 130 131 } else { 132 $el.addClass('appear-animation-visible'); 133 } 134 135 return this; 136 } 137 }; 138 139 // expose to scope 140 $.extend(theme, { 141 PluginAnimate: PluginAnimate 142 }); 143 144 // jquery plugin 145 $.fn.themePluginAnimate = function(opts) { 146 return this.map(function() { 147 var $this = $(this); 148 149 if ($this.data(instanceName)) { 150 return $this.data(instanceName); 151 } else { 152 return new PluginAnimate($this, opts); 153 } 154 155 }); 156 }; 157 158}).apply(this, [window.theme, jQuery]); 159 160// Before / After 161(function(theme, $) { 162 163 theme = theme || {}; 164 165 var instanceName = '__beforeafter'; 166 167 var PluginBeforeAfter = function($el, opts) { 168 return this.initialize($el, opts); 169 }; 170 171 PluginBeforeAfter.defaults = { 172 173 }; 174 175 PluginBeforeAfter.prototype = { 176 initialize: function($el, opts) { 177 this.$el = $el; 178 179 this 180 .setData() 181 .setOptions(opts) 182 .build(); 183 184 return this; 185 }, 186 187 setData: function() { 188 this.$el.data(instanceName, this); 189 190 return this; 191 }, 192 193 setOptions: function(opts) { 194 this.options = $.extend(true, {}, PluginBeforeAfter.defaults, opts, { 195 wrapper: this.$el 196 }); 197 198 return this; 199 }, 200 201 build: function() { 202 203 if (!($.isFunction($.fn.twentytwenty))) { 204 return this; 205 } 206 207 var self = this; 208 209 self.options.wrapper 210 .twentytwenty(self.options); 211 212 return this; 213 214 } 215 }; 216 217 // expose to scope 218 $.extend(theme, { 219 PluginBeforeAfter: PluginBeforeAfter 220 }); 221 222 // jquery plugin 223 $.fn.themePluginBeforeAfter = function(opts) { 224 return this.map(function() { 225 var $this = $(this); 226 227 if ($this.data(instanceName)) { 228 return $this.data(instanceName); 229 } else { 230 return new PluginBeforeAfter($this, opts); 231 } 232 233 });
234 } 235 236}).apply(this, [window.theme, jQuery]); 237 238// Carousel 239(function(theme, $) { 240 241 theme = theme || {}; 242 243 var instanceName = '__carousel'; 244 245 var PluginCarousel = function($el, opts) { 246 return this.initialize($el, opts); 247 }; 248 249 PluginCarousel.defaults = { 250 loop: true, 251 responsive: { 252 0: { 253 items: 1 254 }, 255 479: { 256 items: 1 257 }, 258 768: { 259 items: 2 260 }, 261 979: { 262 items: 3 263 }, 264 1199: { 265 items: 4 266 } 267 }, 268 navText: [] 269 }; 270 271 PluginCarousel.prototype = { 272 initialize: function($el, opts) { 273 if ($el.data(instanceName)) { 274 return this; 275 } 276 277 this.$el = $el; 278 279 this 280 .setData() 281 .setOptions(opts) 282 .build(); 283 284 return this; 285 }, 286 287 setData: function() { 288 this.$el.data(instanceName, this); 289 290 return this; 291 }, 292 293 setOptions: function(opts) { 294 this.options = $.extend(true, {}, PluginCarousel.defaults, opts, { 295 wrapper: this.$el 296 }); 297 298 return this; 299 }, 300 301 build: function() { 302 if (!($.isFunction($.fn.owlCarousel))) { 303 return this; 304 } 305 306 var self = this, 307 $el = this.options.wrapper; 308 309 // Add Theme Class 310 $el.addClass('owl-theme'); 311 312 // Add Loading 313 $el.addClass('owl-loading'); 314 315 // Force RTL according to HTML dir attribute 316 if ($('html').attr('dir') == 'rtl') { 317 this.options = $.extend(true, {}, this.options, { 318 rtl: true 319 }); 320 } 321 322 if (this.options.items == 1) { 323 this.options.responsive = {} 324 } 325 326 if (this.options.items > 4) { 327 this.options = $.extend(true, {}, this.options, { 328 responsive: { 329 1199: { 330 items: this.options.items 331 } 332 } 333 }); 334 } 335 336 // Auto Height Fixes 337 if (this.options.autoHeight) { 338 var itemsHeight = []; 339 340 $el.find('.owl-item').each(function(){ 341 if( $(this).hasClass('active') ) { 342 itemsHeight.push( $(this).height() ); 343 } 344 }); 345 346 $(window).afterResize(function() { 347 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 348 }); 349 350 $(window).on('load', function() { 351 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 352 }); 353 } 354 355 // Initialize OwlCarousel 356 $el.owlCarousel(this.options).addClass('owl-carousel-init'); 357 358 // Sync 359 if ($el.attr('data-sync')) { 360 $el.on('change.owl.carousel', function(event) { 361 if (event.namespace && event.property.name === 'position') { 362 var target = event.relatedTarget.relative(event.property.value, true); 363 $( $el.data('sync') ).owlCarousel('to', target, 300, true); 364 } 365 }); 366 } 367 368 // Carousel Center Active Item 369 if( $el.hasClass('carousel-center-active-item') ) { 370 var itemsActive = $el.find('.owl-item.active'), 371 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
372 itemCenter = itemsActive.eq(indexCenter); 373 374 itemCenter.addClass('current'); 375 376 $el.on('change.owl.carousel', function(event) { 377 $el.find('.owl-item').removeClass('current'); 378 379 setTimeout(function(){ 380 var itemsActive = $el.find('.owl-item.active'), 381 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ), 382 itemCenter = itemsActive.eq(indexCenter); 383 384 itemCenter.addClass('current'); 385 }, 100); 386 }); 387 388 // Refresh 389 $el.trigger('refresh.owl.carousel'); 390 391 } 392 393 // Remove Loading 394 $el.removeClass('owl-loading'); 395 396 // Remove Height 397 $el.css('height', 'auto'); 398 399 return this; 400 } 401 }; 402 403 // expose to scope 404 $.extend(theme, { 405 PluginCarousel: PluginCarousel 406 }); 407 408 // jquery plugin 409 $.fn.themePluginCarousel = function(opts) { 410 return this.map(function() { 411 var $this = $(this); 412 413 if ($this.data(instanceName)) { 414 return $this.data(instanceName); 415 } else { 416 return new PluginCarousel($this, opts); 417 } 418 419 }); 420 } 421 422}).apply(this, [window.theme, jQuery]); 423 424// Chart Circular 425(function(theme, $) { 426 427 theme = theme || {}; 428 429 var instanceName = '__chartCircular'; 430 431 var PluginChartCircular = function($el, opts) { 432 return this.initialize($el, opts); 433 }; 434 435 PluginChartCircular.defaults = { 436 accX: 0, 437 accY: -150, 438 delay: 1, 439 barColor: '#0088CC', 440 trackColor: '#f2f2f2', 441 scaleColor: false, 442 scaleLength: 5, 443 lineCap: 'round', 444 lineWidth: 13, 445 size: 175, 446 rotate: 0, 447 animate: ({ 448 duration: 2500, 449 enabled: true 450 }) 451 }; 452 453 PluginChartCircular.prototype = { 454 initialize: function($el, opts) { 455 if ($el.data(instanceName)) { 456 return this; 457 } 458 459 this.$el = $el; 460 461 this 462 .setData() 463 .setOptions(opts) 464 .build(); 465 466 return this; 467 }, 468 469 setData: function() { 470 this.$el.data(instanceName, this); 471 472 return this; 473 }, 474 475 setOptions: function(opts) { 476 this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, { 477 wrapper: this.$el 478 }); 479 480 return this; 481 }, 482 483 build: function() { 484 if (!($.isFunction($.fn.appear)) || !($.isFunction($.fn.easyPieChart))) { 485 return this; 486 } 487 488 var self = this, 489 $el = this.options.wrapper, 490 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0), 491 percentEl = $el.find('.percent'); 492 493 $.extend(true, self.options, { 494 onStep: function(from, to, currentValue) { 495 percentEl.html(parseInt(currentValue)); 496 } 497 }); 498 499 $el.attr('data-percent', 0); 500 501 $el.appear(function() { 502 503 $el.easyPieChart(self.options); 504 505 setTimeout(function() { 506 507 $el.data('easyPieChart').update(value); 508 $el.attr('data-percent', value); 509 510 }, self.options.delay); 511 512 }, { 513 accX: self.options.accX, 514 accY: self.options.accY 515 }); 516 517 return this; 518 } 519 }; 520 521 // expose to scope 522 $.extend(theme, { 523 PluginChartCircular: PluginChartCircular 524 }); 525 526 // jquery plugin 527 $.fn.themePluginChartCircular = function(opts) { 528 return this.map(function() { 529 var $this = $(this); 530 531 if ($this.data(instanceName)) { 532 return $this.data(instanceName); 533 } else { 534 return new PluginChartCircular($this, opts); 535 } 536 537 }); 538 } 539 540}).apply(this, [window.theme, jQuery]); 541 542// Countdown 543(function(theme, $) { 544 545 theme = theme || {}; 546 547 var instanceName = '__countdown'; 548 549 var PluginCountdown = function($el, opts) { 550 return this.initialize($el, opts); 551 }; 552 553 PluginCountdown.defaults = { 554 date: '2030/06/10 12:00:00', 555 textDay: 'DAY', 556 textHour: 'HRS', 557 textMin: 'MIN', 558 textSec: 'SEC', 559 uppercase: true, 560 numberClass: '', 561 wrapperClass: '', 562 insertHTMLbefore: '', 563 insertHTMLafter: '' 564 }; 565 566 PluginCountdown.prototype = { 567 initialize: function($el, opts) { 568 if ($el.data(instanceName)) { 569 return this; 570 } 571 572 this.$el = $el; 573 574 this 575 .setData() 576 .setOptions(opts) 577 .build(); 578 579 return this; 580 }, 581 582 setData: function() { 583 this.$el.data(instanceName, this); 584 585 return this; 586 }, 587 588 setOptions: function(opts) { 589 this.options = $.extend(true, {}, PluginCountdown.defaults, opts, { 590 wrapper: this.$el 591 }); 592 593 return this; 594 }, 595 596 build: function() { 597 if (!($.isFunction($.fn.countTo))) { 598 return this; 599 } 600 601 var self = this, 602 $el = this.options.wrapper, 603 numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '', 604 wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : ''; 605 606 if( self.options.uppercase ) { 607 $el.countdown(self.options.date).on('update.countdown', function(event) { 608 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore 609 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'<div class="d-inline text-uppercase">%!d</div></span> ' 610 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> ' 611 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> ' 612 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> ' 613 + self.options.insertHTMLafter 614 )); 615 }); 616 } else { 617 $el.countdown(self.options.date).on('update.countdown', function(event) { 618 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore 619 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'%!d</span> ' 620 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> ' 621 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> ' 622 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> ' 623 + self.options.insertHTMLafter 624 )); 625 }); 626 } 627 628 return this; 629 } 630 }; 631 632 // expose to scope 633 $.extend(theme, { 634 PluginCountdown: PluginCountdown 635 }); 636 637 // jquery plugin 638 $.fn.themePluginCountdown = function(opts) { 639 return this.map(function() { 640 var $this = $(this); 641 642 if ($this.data(instanceName)) { 643 return $this.data(instanceName); 644 } else { 645 return new PluginCountdown($this, opts); 646 } 647 648 });
649 } 650 651}).apply(this, [window.theme, jQuery]); 652 653// Counter 654(function(theme, $) { 655 656 theme = theme || {}; 657 658 var instanceName = '__counter'; 659 660 var PluginCounter = function($el, opts) { 661 return this.initialize($el, opts); 662 }; 663 664 PluginCounter.defaults = { 665 accX: 0, 666 accY: 0, 667 speed: 3000, 668 refreshInterval: 100, 669 decimals: 0, 670 formatter: function (value, options) { 671 value = value.toFixed(options.decimals); 672 value = value.replace(/\B(?=(\d{3})+(?!\d))/g, ','); 673 return value; 674 }, 675 onUpdate: null, 676 onComplete: null 677 }; 678 679 PluginCounter.prototype = { 680 initialize: function($el, opts) { 681 if ($el.data(instanceName)) { 682 return this; 683 } 684 685 this.$el = $el; 686 687 this 688 .setData() 689 .setOptions(opts) 690 .build(); 691 692 return this; 693 }, 694 695 setData: function() { 696 this.$el.data(instanceName, this); 697 698 return this; 699 }, 700 701 setOptions: function(opts) { 702 this.options = $.extend(true, {}, PluginCounter.defaults, opts, { 703 wrapper: this.$el 704 }); 705 706 return this; 707 }, 708 709 build: function() { 710 if (!($.isFunction($.fn.countTo))) { 711 return this; 712 } 713 714 var self = this, 715 $el = this.options.wrapper; 716 717 $.extend(self.options, { 718 onComplete: function() { 719 if ($el.data('append')) { 720 $el.html($el.html() + $el.data('append')); 721 } 722 723 if ($el.data('prepend')) { 724 $el.html($el.data('prepend') + $el.html()); 725 } 726 } 727 }); 728 729 $el.appear(function() { 730 731 $el.countTo(self.options); 732 733 }, { 734 accX: self.options.accX, 735 accY: self.options.accY 736 }); 737 738 return this; 739 } 740 }; 741 742 // expose to scope 743 $.extend(theme, { 744 PluginCounter: PluginCounter 745 }); 746 747 // jquery plugin 748 $.fn.themePluginCounter = function(opts) { 749 return this.map(function() { 750 var $this = $(this); 751 752 if ($this.data(instanceName)) { 753 return $this.data(instanceName); 754 } else { 755 return new PluginCounter($this, opts); 756 } 757 758 }); 759 } 760 761}).apply(this, [window.theme, jQuery]); 762 763 764// Lazy Load 765(function(theme, $) { 766 767 theme = theme || {}; 768 769 var instanceName = '__lazyload'; 770 771 var PluginLazyLoad = function($el, opts) { 772 return this.initialize($el, opts); 773 }; 774 775 PluginLazyLoad.defaults = { 776 effect: 'show', 777 appearEffect: '', 778 imgFluid: true, 779 appear: function(elements_left, settings) { 780 781 }, 782 load: function(elements_left, settings) { 783 $(this).addClass($.trim('lazy-load-loaded ' + settings.appearEffect)).css({ 784 'animation-duration': '1s' 785 }); 786 } 787 }; 788 789 PluginLazyLoad.prototype = { 790 initialize: function($el, opts) { 791 if ($el.data(instanceName)) { 792 return this; 793 } 794 795 this.$el = $el; 796 797 this 798 .setData() 799 .setOptions(opts) 800 .build() 801 .events(); 802 803 return this; 804 }, 805 806 setData: function() { 807 this.$el.data(instanceName, this); 808 809 return this; 810 }, 811 812 setOptions: function(opts) { 813 this.options = $.extend(true, {}, PluginLazyLoad.defaults, opts, { 814 wrapper: this.$el 815 }); 816 817 return this; 818 }, 819 820 build: function() { 821 if (!($.isFunction($.fn.lazyload))) { 822 return this; 823 } 824 825 var self = this; 826 827 self.options.wrapper.lazyload(this.options); 828 829 return this; 830 }, 831 832 events: function() { 833 var self = this; 834 835 if( self.options.imgFluid && self.options.wrapper.is('img') ) { 836 self.options.wrapper.on('appear', function(){ 837 setTimeout(function(){ 838 self.options.wrapper.addClass('img-fluid'); 839 }, 500); 840 }); 841 } 842 843 return this; 844 } 845 }; 846 847 // expose to scope 848 $.extend(theme, { 849 PluginLazyLoad: PluginLazyLoad 850 }); 851 852 // jquery plugin 853 $.fn.themePluginLazyLoad = function(opts) { 854 return this.map(function() { 855 var $this = $(this); 856 857 if ($this.data(instanceName)) { 858 return $this.data(instanceName); 859 } else { 860 return new PluginLazyLoad($this, opts); 861 } 862 863 });
864 } 865 866}).apply(this, [window.theme, jQuery]); 867 868// Lightbox 869(function(theme, $) { 870 871 theme = theme || {}; 872 873 var instanceName = '__lightbox'; 874 875 var PluginLightbox = function($el, opts) { 876 return this.initialize($el, opts); 877 }; 878 879 PluginLightbox.defaults = { 880 tClose: 'Close (Esc)', // Alt text on close button 881 tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys 882 gallery: { 883 tPrev: 'Previous (Left arrow key)', // Alt text on left arrow 884 tNext: 'Next (Right arrow key)', // Alt text on right arrow 885 tCounter: '%curr% of %total%' // Markup for "1 of 7" counter 886 }, 887 image: { 888 tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded 889 }, 890 ajax: { 891 tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed 892 }, 893 callbacks: { 894 open: function() { 895 $('html').addClass('lightbox-opened'); 896 }, 897 close: function() { 898 $('html').removeClass('lightbox-opened'); 899 } 900 } 901 }; 902 903 PluginLightbox.prototype = { 904 initialize: function($el, opts) { 905 if ($el.data(instanceName)) { 906 return this; 907 } 908 909 this.$el = $el; 910 911 this 912 .setData() 913 .setOptions(opts) 914 .build(); 915 916 return this; 917 }, 918 919 setData: function() { 920 this.$el.data(instanceName, this); 921 922 return this; 923 }, 924 925 setOptions: function(opts) { 926 this.options = $.extend(true, {}, PluginLightbox.defaults, opts, { 927 wrapper: this.$el 928 }); 929 930 return this; 931 }, 932 933 build: function() { 934 if (!($.isFunction($.fn.magnificPopup))) { 935 return this; 936 } 937 938 this.options.wrapper.magnificPopup(this.options); 939 940 return this; 941 } 942 }; 943 944 // expose to scope 945 $.extend(theme, { 946 PluginLightbox: PluginLightbox 947 }); 948 949 // jquery plugin 950 $.fn.themePluginLightbox = function(opts) { 951 return this.map(function() { 952 var $this = $(this); 953 954 if ($this.data(instanceName)) { 955 return $this.data(instanceName); 956 } else { 957 return new PluginLightbox($this, opts); 958 } 959 960 }); 961 } 962 963}).apply(this, [window.theme, jQuery]); 964 965// Loading Overlay 966(function(theme, $) { 967 968 'use strict'; 969 970 theme = theme || {}; 971 972 var loadingOverlayTemplate = [ 973 '<div class="loading-overlay">', 974 '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>', 975 '</div>' 976 ].join(''); 977 978 var LoadingOverlay = function( $wrapper, options ) { 979 return this.initialize( $wrapper, options ); 980 }; 981 982 LoadingOverlay.prototype = { 983 984 options: { 985 css: {}, 986 hideDelay: 500 987 }, 988 989 initialize: function( $wrapper, options ) { 990 this.$wrapper = $wrapper; 991 992 this 993 .setVars() 994 .setOptions( options ) 995 .build() 996 .events(); 997 998 this.$wrapper.data( 'loadingOverlay', this ); 999 }, 1000 1001 setVars: function() { 1002 this.$overlay = this.$wrapper.find('.loading-overlay'); 1003 1004 return this; 1005 }, 1006 1007 setOptions: function( options ) { 1008 if ( !this.$overlay.get(0) ) { 1009 this.matchProperties(); 1010 } 1011 this.options = $.extend( true, {}, this.options, options, theme.fn.getOptions(this.$wrapper.data('plugin-options')) ); 1012 1013 this.loaderClass = this.getLoaderClass( this.options.css.backgroundColor ); 1014 1015 return this; 1016 }, 1017 1018 build: function() { 1019 if ( !this.$overlay.closest(document.documentElement).get(0) ) { 1020 if ( !this.$cachedOverlay ) { 1021 this.$overlay = $( loadingOverlayTemplate ).clone(); 1022 1023 if ( this.options.css ) { 1024 this.$overlay.css( this.options.css ); 1025 this.$overlay.find( '.loader' ).addClass( this.loaderClass ); 1026 } 1027 } else { 1028 this.$overlay = this.$cachedOverlay.clone(); 1029 } 1030 1031 this.$wrapper.append( this.$overlay ); 1032 } 1033 1034 if ( !this.$cachedOverlay ) { 1035 this.$cachedOverlay = this.$overlay.clone(); 1036 } 1037 1038 return this; 1039 }, 1040 1041 events: function() { 1042 var _self = this; 1043 1044 if ( this.options.startShowing ) { 1045 _self.show(); 1046 } 1047 1048 if ( this.$wrapper.is('body') || this.options.hideOnWindowLoad ) { 1049 $( window ).on( 'load error', function() { 1050 _self.hide(); 1051 }); 1052 } 1053 1054 if ( this.options.listenOn ) { 1055 $( this.options.listenOn ) 1056 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 1057 e.stopPropagation(); 1058 _self.show(); 1059 }) 1060 .on( 'loading-overlay:hide complete.ic', function( e ) { 1061 e.stopPropagation(); 1062 _self.hide(); 1063 }); 1064 } 1065 1066 this.$wrapper 1067 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 1068 if ( e.target === _self.$wrapper.get(0) ) { 1069 e.stopPropagation(); 1070 _self.show(); 1071 return true; 1072 } 1073 return false; 1074 }) 1075 .on( 'loading-overlay:hide complete.ic', function( e ) { 1076 if ( e.target === _self.$wrapper.get(0) ) { 1077 e.stopPropagation(); 1078 _self.hide(); 1079 return true; 1080 } 1081 return false; 1082 }); 1083 1084 return this; 1085 }, 1086 1087 show: function() { 1088 this.build(); 1089 1090 this.position = this.$wrapper.css( 'position' ).toLowerCase(); 1091 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 1092 this.$wrapper.css({ 1093 position: 'relative' 1094 }); 1095 } 1096 this.$wrapper.addClass( 'loading-overlay-showing' ); 1097 }, 1098 1099 hide: function() { 1100 var _self = this; 1101 1102 setTimeout(function() { 1103 _self.$wrapper.removeClass( 'loading-overlay-showing' ); 1104 1105 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 1106 _self.$wrapper.css({ position: '' }); 1107 } 1108 1109 $(window).trigger('loading.overlay.ready'); 1110 }, _self.options.hideDelay); 1111 }, 1112 1113 matchProperties: function() { 1114 var i, 1115 l, 1116 properties; 1117 1118 properties = [ 1119 'backgroundColor', 1120 'borderRadius' 1121 ]; 1122 1123 l = properties.length; 1124 1125 for( i = 0; i < l; i++ ) { 1126 var obj = {}; 1127 obj[ properties[ i ] ] = this.$wrapper.css( properties[ i ] ); 1128 1129 $.extend( this.options.css, obj ); 1130 } 1131 }, 1132 1133 getLoaderClass: function( backgroundColor ) { 1134 if ( !backgroundColor || backgroundColor === 'transparent' || backgroundColor === 'inherit' ) { 1135 return 'black'; 1136 } 1137 1138 var hexColor, 1139 r, 1140 g, 1141 b, 1142 yiq; 1143
1144 var colorToHex = function( color ){ 1145 var hex, 1146 rgb; 1147 1148 if( color.indexOf('#') >- 1 ){ 1149 hex = color.replace('#', ''); 1150 } else { 1151 rgb = color.match(/\d+/g); 1152 hex = ('0' + parseInt(rgb[0], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2); 1153 } 1154 1155 if ( hex.length === 3 ) { 1156 hex = hex + hex; 1157 } 1158 1159 return hex; 1160 }; 1161 1162 hexColor = colorToHex( backgroundColor ); 1163 1164 r = parseInt( hexColor.substr( 0, 2), 16 ); 1165 g = parseInt( hexColor.substr( 2, 2), 16 ); 1166 b = parseInt( hexColor.substr( 4, 2), 16 ); 1167 yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 1168 1169 return ( yiq >= 128 ) ? 'black' : 'white'; 1170 } 1171 1172 }; 1173 1174 // expose to scope 1175 $.extend(theme, { 1176 LoadingOverlay: LoadingOverlay 1177 }); 1178 1179 // expose as a jquery plugin 1180 $.fn.loadingOverlay = function( opts ) { 1181 return this.each(function() { 1182 var $this = $( this ); 1183 1184 var loadingOverlay = $this.data( 'loadingOverlay' ); 1185 if ( loadingOverlay ) { 1186 return loadingOverlay; 1187 } else { 1188 var options = opts || $this.data( 'loading-overlay-options' ) || {}; 1189 return new LoadingOverlay( $this, options ); 1190 } 1191 }); 1192 } 1193 1194 // auto init 1195 $('[data-loading-overlay]').loadingOverlay(); 1196 1197}).apply(this, [window.theme, jQuery]); 1198 1199// Masonry 1200(function(theme, $) { 1201 1202 theme = theme || {}; 1203 1204 var instanceName = '__masonry'; 1205 1206 var PluginMasonry = function($el, opts) { 1207 return this.initialize($el, opts); 1208 }; 1209 1210 PluginMasonry.defaults = { 1211 1212 }; 1213 1214 PluginMasonry.prototype = { 1215 initialize: function($el, opts) { 1216 if ($el.data(instanceName)) { 1217 return this; 1218 } 1219 1220 this.$el = $el; 1221 1222 this 1223 .setData() 1224 .setOptions(opts) 1225 .build(); 1226 1227 return this; 1228 }, 1229 1230 setData: function() { 1231 this.$el.data(instanceName, this); 1232 1233 return this; 1234 }, 1235 1236 setOptions: function(opts) { 1237 this.options = $.extend(true, {}, PluginMasonry.defaults, opts, { 1238 wrapper: this.$el 1239 }); 1240 1241 return this; 1242 }, 1243 1244 build: function() { 1245 if (!($.isFunction($.fn.isotope))) { 1246 return this; 1247 } 1248 1249 var self = this, 1250 $window = $(window); 1251 1252 self.$loader = false; 1253 1254 if (self.options.wrapper.parents('.masonry-loader').get(0)) { 1255 self.$loader = self.options.wrapper.parents('.masonry-loader'); 1256 self.createLoader(); 1257 } 1258 1259 self.options.wrapper.one('layoutComplete', function(event, laidOutItems) { 1260 self.removeLoader(); 1261 }); 1262 1263 self.options.wrapper.waitForImages(function() { 1264 self.options.wrapper.isotope(self.options); 1265 }); 1266 1267 // IE10/11 fix 1268 if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) { 1269 var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') ); 1270 } 1271 1272 $(window).on('resize', function() { 1273 setTimeout(function() { 1274 self.options.wrapper.isotope('layout'); 1275 }, 300); 1276 }); 1277 1278 setTimeout(function() { 1279 self.removeLoader(); 1280 }, 3000); 1281 1282 return this; 1283 }, 1284 1285 createLoader: function() { 1286 var self = this; 1287 1288 var loaderTemplate = [ 1289 '<div class="bounce-loader">', 1290 '<div class="bounce1"></div>', 1291 '<div class="bounce2"></div>', 1292 '<div class="bounce3"></div>', 1293 '</div>' 1294 ].join(''); 1295 1296 self.$loader.append(loaderTemplate); 1297 1298 return this; 1299 }, 1300 1301 removeLoader: function() { 1302 1303 var self = this; 1304 1305 if (self.$loader) { 1306 1307 self.$loader.removeClass('masonry-loader-showing'); 1308 1309 setTimeout(function() { 1310 self.$loader.addClass('masonry-loader-loaded'); 1311 }, 300); 1312 1313 } 1314 1315 } 1316 }; 1317 1318 // expose to scope 1319 $.extend(theme, { 1320 PluginMasonry: PluginMasonry 1321 }); 1322 1323 // jquery plugin 1324 $.fn.themePluginMasonry = function(opts) { 1325 return this.map(function() { 1326 var $this = $(this); 1327 1328 if ($this.data(instanceName)) { 1329 return $this.data(instanceName); 1330 } else { 1331 return new PluginMasonry($this, opts); 1332 } 1333 1334 });
1335 } 1336 1337}).apply(this, [window.theme, jQuery]); 1338 1339// Match Height 1340(function(theme, $) { 1341 1342 theme = theme || {}; 1343 1344 var instanceName = '__matchHeight'; 1345 1346 var PluginMatchHeight = function($el, opts) { 1347 return this.initialize($el, opts); 1348 }; 1349 1350 PluginMatchHeight.defaults = { 1351 byRow: true, 1352 property: 'height', 1353 target: null, 1354 remove: false 1355 }; 1356 1357 PluginMatchHeight.prototype = { 1358 initialize: function($el, opts) { 1359 if ($el.data(instanceName)) { 1360 return this; 1361 } 1362 1363 this.$el = $el; 1364 1365 this 1366 .setData() 1367 .setOptions(opts) 1368 .build(); 1369 1370 return this; 1371 }, 1372 1373 setData: function() { 1374 this.$el.data(instanceName, this); 1375 1376 return this; 1377 }, 1378 1379 setOptions: function(opts) { 1380 this.options = $.extend(true, {}, PluginMatchHeight.defaults, opts, { 1381 wrapper: this.$el 1382 }); 1383 1384 return this; 1385 }, 1386 1387 build: function() { 1388 if (!($.isFunction($.fn.matchHeight))) { 1389 return this; 1390 } 1391 1392 var self = this; 1393 1394 self.options.wrapper.matchHeight(self.options); 1395 1396 return this; 1397 } 1398 1399 }; 1400 1401 // expose to scope 1402 $.extend(theme, { 1403 PluginMatchHeight: PluginMatchHeight 1404 }); 1405 1406 // jquery plugin 1407 $.fn.themePluginMatchHeight = function(opts) { 1408 return this.map(function() { 1409 var $this = $(this); 1410 1411 if ($this.data(instanceName)) { 1412 return $this.data(instanceName); 1413 } else { 1414 return new PluginMatchHeight($this, opts); 1415 } 1416 1417 }); 1418 } 1419 1420}).apply(this, [window.theme, jQuery]); 1421 1422// Parallax 1423(function(theme, $) { 1424 1425 theme = theme || {}; 1426 1427 var instanceName = '__parallax'; 1428 1429 var PluginParallax = function($el, opts) { 1430 return this.initialize($el, opts); 1431 }; 1432 1433 PluginParallax.defaults = { 1434 speed: 1.5, 1435 horizontalPosition: '50%', 1436 offset: 0, 1437 parallaxHeight: '180%' 1438 }; 1439 1440 PluginParallax.prototype = { 1441 initialize: function($el, opts) { 1442 if ($el.data(instanceName)) { 1443 return this; 1444 } 1445 1446 this.$el = $el; 1447 1448 this 1449 .setData() 1450 .setOptions(opts) 1451 .build(); 1452 1453 return this; 1454 }, 1455 1456 setData: function() { 1457 this.$el.data(instanceName, this); 1458 1459 return this; 1460 }, 1461 1462 setOptions: function(opts) { 1463 this.options = $.extend(true, {}, PluginParallax.defaults, opts, { 1464 wrapper: this.$el 1465 }); 1466 1467 return this; 1468 }, 1469 1470 build: function() { 1471 var self = this, 1472 $window = $(window), 1473 offset, 1474 yPos, 1475 bgpos, 1476 background; 1477 1478 // Create Parallax Element 1479 background = $('<div class="parallax-background"></div>'); 1480 1481 // Set Style for Parallax Element 1482 background.css({ 1483 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')', 1484 'background-size' : 'cover', 1485 'position' : 'absolute', 1486 'top' : 0, 1487 'left' : 0, 1488 'width' : '100%', 1489 'height' : self.options.parallaxHeight 1490 }); 1491 1492 // Add Parallax Element on DOM 1493 self.options.wrapper.prepend(background); 1494 1495 // Set Overlfow Hidden and Position Relative to Parallax Wrapper 1496 self.options.wrapper.css({ 1497 'position' : 'relative', 1498 'overflow' : 'hidden' 1499 }); 1500 1501 // Parallax Effect on Scroll & Resize 1502 var parallaxEffectOnScrolResize = function() { 1503 $window.on('scroll resize', function() { 1504 offset = self.options.wrapper.offset(); 1505 yPos = -($window.scrollTop() - (offset.top - 100)) / ((self.options.speed + 2 )); 1506 plxPos = (yPos < 0) ? Math.abs(yPos) : -Math.abs(yPos); 1507 background.css({ 1508 'transform' : 'translate3d(0, '+ ( (plxPos - 50) + (self.options.offset) ) +'px, 0)', 1509 'background-position-x' : self.options.horizontalPosition 1510 }); 1511 }); 1512 1513 $window.trigger('scroll'); 1514 } 1515 1516 if (!$.browser.mobile) { 1517 parallaxEffectOnScrolResize(); 1518 } else { 1519 if( self.options.enableOnMobile == true ) { 1520 parallaxEffectOnScrolResize(); 1521 } else { 1522 self.options.wrapper.addClass('parallax-disabled'); 1523 } 1524 } 1525 1526 return this; 1527 } 1528 }; 1529 1530 // expose to scope 1531 $.extend(theme, { 1532 PluginParallax: PluginParallax 1533 }); 1534 1535 // jquery plugin 1536 $.fn.themePluginParallax = function(opts) { 1537 return this.map(function() { 1538 var $this = $(this); 1539 1540 if ($this.data(instanceName)) { 1541 return $this.data(instanceName); 1542 } else { 1543 return new PluginParallax($this, opts); 1544 } 1545 1546 });
1547 } 1548 1549}).apply(this, [window.theme, jQuery]); 1550 1551// Progress Bar 1552(function(theme, $) { 1553 1554 theme = theme || {}; 1555 1556 var instanceName = '__progressBar'; 1557 1558 var PluginProgressBar = function($el, opts) { 1559 return this.initialize($el, opts); 1560 }; 1561 1562 PluginProgressBar.defaults = { 1563 accX: 0, 1564 accY: -50, 1565 delay: 1 1566 }; 1567 1568 PluginProgressBar.prototype = { 1569 initialize: function($el, opts) { 1570 if ($el.data(instanceName)) { 1571 return this; 1572 } 1573 1574 this.$el = $el; 1575 1576 this 1577 .setData() 1578 .setOptions(opts) 1579 .build(); 1580 1581 return this; 1582 }, 1583 1584 setData: function() { 1585 this.$el.data(instanceName, this); 1586 1587 return this; 1588 }, 1589 1590 setOptions: function(opts) { 1591 this.options = $.extend(true, {}, PluginProgressBar.defaults, opts, { 1592 wrapper: this.$el 1593 }); 1594 1595 return this; 1596 }, 1597 1598 build: function() { 1599 if (!($.isFunction($.fn.appear))) { 1600 return this; 1601 } 1602 1603 var self = this, 1604 $el = this.options.wrapper, 1605 delay = 1; 1606 1607 $el.appear(function() { 1608 1609 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 1610 1611 $el.addClass($el.attr('data-appear-animation')); 1612 1613 setTimeout(function() { 1614 1615 $el.animate({ 1616 width: $el.attr('data-appear-progress-animation') 1617 }, 1500, 'easeOutQuad', function() { 1618 $el.find('.progress-bar-tooltip').animate({ 1619 opacity: 1 1620 }, 500, 'easeOutQuad'); 1621 }); 1622 1623 }, delay); 1624 1625 }, { 1626 accX: self.options.accX, 1627 accY: self.options.accY 1628 }); 1629 1630 return this; 1631 } 1632 }; 1633 1634 // expose to scope 1635 $.extend(theme, { 1636 PluginProgressBar: PluginProgressBar 1637 }); 1638 1639 // jquery plugin 1640 $.fn.themePluginProgressBar = function(opts) { 1641 return this.map(function() { 1642 var $this = $(this); 1643 1644 if ($this.data(instanceName)) { 1645 return $this.data(instanceName); 1646 } else { 1647 return new PluginProgressBar($this, opts); 1648 } 1649 1650 }); 1651 } 1652 1653}).apply(this, [window.theme, jQuery]); 1654 1655// Scroll to Top 1656 1657(function(theme, $) { 1658 theme = theme || {}; 1659 var footerBar=''; 1660 if($('html body').find('.fix-footer').length>0){ 1661 footerBar = ' fixbar'; 1662 } 1663 $.extend(theme, { 1664 PluginScrollToTop: { 1665 defaults: { 1666 wrapper: $('body'), 1667 offset: 250, 1668 buttonClass: 'scroll-to-top'+footerBar, 1669 iconClass: 'fal fa-arrow-up', 1670 delay: 1000, 1671 visibleMobile: false, 1672 label: false, 1673 easing: 'easeOutBack' 1674 }, 1675 initialize: function(opts) { 1676 initialized = true; 1677 1678 // Don't initialize if the page has Section Scroll 1679 if( $('body[data-plugin-section-scroll]').get(0) ) { 1680 return; 1681 } 1682 1683 this 1684 .setOptions(opts) 1685 .build() 1686 .events(); 1687 1688 return this; 1689 }, 1690 setOptions: function(opts) { 1691 this.options = $.extend(true, {}, this.defaults, opts); 1692 1693 return this; 1694 }, 1695 build: function() { 1696 var self = this, 1697 $el; 1698 1699 // Base HTML Markup 1700 $el = $('<a />') 1701 .addClass(self.options.buttonClass) 1702 .attr({ 1703 'href': '#', 1704 }) 1705 .append( 1706 $('<i />') 1707 .addClass(self.options.iconClass) 1708 ); 1709 1710 // Label 1711 if (self.options.label) { 1712 $el.append( 1713 $('<span />').html(self.options.label) 1714 ); 1715 } 1716 1717 this.options.wrapper.append($el); 1718 1719 this.$el = $el; 1720 1721 return this; 1722 }, 1723 events: function() { 1724 var self = this, 1725 _isScrolling = false; 1726 1727 // Click Element Action 1728 self.$el.on('click', function(e) { 1729 e.preventDefault(); 1730 var el= 'body, html'; 1731 if($(this).hasClass('maps')){ 1732 el = '#contInfo'; 1733 } 1734 1735 $(el).animate({ 1736 scrollTop: 0 1737 }, self.options.delay, self.options.easing); 1738 return false; 1739 }); 1740 1741 // Show/Hide Button on Window Scroll event. 1742 $(window).scroll(function() { 1743 1744 if (!_isScrolling) { 1745 1746 _isScrolling = true; 1747 1748 if ($(window).scrollTop() > self.options.offset) { 1749 1750 self.$el.stop(true, true).addClass('d-block visible'); 1751 _isScrolling = false; 1752 1753 } else { 1754 1755 self.$el.stop(true, true).removeClass('d-block visible'); 1756 _isScrolling = false; 1757 1758 } 1759 1760 } 1761 1762 }); 1763 1764 return this; 1765 } 1766 } 1767 }); 1768}).apply(this, [window.theme, jQuery]); 1769 1770 1771//채용알람 1772(function(theme, $) { 1773 theme = theme || {}; 1774 1775 $.extend(theme, { 1776 AlramFooterBtn: { 1777 defaults: { 1778 wrapper: $('body'), 1779 offset: 250, 1780 buttonClass: 'scroll-footer-alram', 1781 iconClass: '', 1782 delay: 1000, 1783 visibleMobile: false, 1784 label: false, 1785 easing: 'easeOutBack' 1786 }, 1787 initialize: function(opts) { 1788 initialized = true; 1789 1790 // Don't initialize if the page has Section Scroll 1791 if( $('body[data-plugin-section-scroll]').get(0) ) { 1792 return; 1793 } 1794 1795 this 1796 .setOptions(opts) 1797 .build() 1798 .events(); 1799 1800 return this; 1801 }, 1802 setOptions: function(opts) { 1803 this.options = $.extend(true, {}, this.defaults, opts); 1804 1805 return this; 1806 }, 1807 build: function() { 1808 var self = this, 1809 $el; 1810 1811 // Base HTML Markup 1812 $el = $('<div />') 1813 .append('<a href="javascript:;" class="alram-link"><img src="/v1/assets/img/footer_alram.png" alt="채용알람" /></a>') 1814 .addClass(self.options.buttonClass) 1815 .append( 1816 $('<a href="javascript:;" class="alram-close"><span class="fal' + 1817 ' fa-xmark"></span></a>') 1818 .addClass(self.options.iconClass) 1819 ); 1820 1821 this.options.wrapper.append($el); 1822 this.$el = $el; 1823 1824 return this; 1825 }, 1826 events: function() { 1827 var self = this, 1828 _isScrolling = false; 1829 1830 1831 // Show/Hide Button on Window Scroll event. 1832 $(window).scroll(function() { 1833 if (!_isScrolling) { 1834 _isScrolling = true; 1835 if ($(window).scrollTop() > self.options.offset) { 1836 self.$el.stop(true, true).addClass('d-block visible'); 1837 _isScrolling = false; 1838 } else { 1839 self.$el.stop(true, true).removeClass('d-block visible'); 1840 _isScrolling = false; 1841 } 1842 } 1843 }); 1844 return this; 1845 } 1846 } 1847 }); 1848}).apply(this, [window.theme, jQuery]); 1849 1850// Star Rating 1851(function(theme, $) { 1852 1853 theme = theme || {}; 1854 1855 var instanceName = '__starrating'; 1856 1857 var PluginStarRating = function($el, opts) { 1858 return this.initialize($el, opts); 1859 }; 1860 1861 PluginStarRating.defaults = { 1862 theme: 'krajee-fas', 1863 color: 'primary', 1864 showClear: false, 1865 showCaption: false 1866 }; 1867 1868 PluginStarRating.prototype = { 1869 initialize: function($el, opts) { 1870 this.$el = $el; 1871 1872 this 1873 .setData() 1874 .setOptions(opts) 1875 .build(); 1876 1877 return this; 1878 }, 1879 1880 setData: function() { 1881 this.$el.data(instanceName, this); 1882 1883 return this; 1884 }, 1885 1886 setOptions: function(opts) { 1887 this.options = $.extend(true, {}, PluginStarRating.defaults, opts, { 1888 wrapper: this.$el 1889 }); 1890 1891 return this; 1892 }, 1893 1894 build: function() { 1895 1896 if (!($.isFunction($.fn.rating))) { 1897 return this; 1898 } 1899 1900 var self = this; 1901 1902 self.options.wrapper 1903 .rating(self.options); 1904 1905 self.options.wrapper.parents('.rating-container') 1906 .addClass('rating-' + self.options.color); 1907 1908 return this; 1909 1910 } 1911 }; 1912 1913 // expose to scope 1914 $.extend(theme, { 1915 PluginStarRating: PluginStarRating 1916 }); 1917 1918 // jquery plugin 1919 $.fn.themePluginStarRating = function(opts) { 1920 return this.map(function() { 1921 var $this = $(this); 1922 1923 if ($this.data(instanceName)) { 1924 return $this.data(instanceName); 1925 } else { 1926 return new PluginStarRating($this, opts); 1927 } 1928 1929 });
1930 } 1931 1932}).apply(this, [window.theme, jQuery]); 1933 1934// Sticky 1935(function(theme, $) { 1936 1937 theme = theme || {}; 1938 1939 var instanceName = '__sticky'; 1940 1941 var PluginSticky = function($el, opts) { 1942 return this.initialize($el, opts); 1943 }; 1944 1945 PluginSticky.defaults = { 1946 minWidth: 991, 1947 activeClass: 'sticky-active' 1948 }; 1949 1950 PluginSticky.prototype = { 1951 initialize: function($el, opts) { 1952 if ( $el.data( instanceName ) ) { 1953 return this; 1954 } 1955 1956 this.$el = $el; 1957 1958 this 1959 .setData() 1960 .setOptions(opts) 1961 .build() 1962 .events(); 1963 1964 return this; 1965 }, 1966 1967 setData: function() { 1968 this.$el.data(instanceName, this); 1969 1970 return this; 1971 }, 1972 1973 setOptions: function(opts) { 1974 this.options = $.extend(true, {}, PluginSticky.defaults, opts, { 1975 wrapper: this.$el 1976 }); 1977 1978 return this; 1979 }, 1980 1981 build: function() { 1982 if (!($.isFunction($.fn.pin))) { 1983 return this; 1984 } 1985 1986 var self = this, 1987 $window = $(window); 1988 1989 self.options.wrapper.pin(self.options); 1990 1991 if( self.options.wrapper.hasClass('sticky-wrapper-transparent') ) { 1992 self.options.wrapper.parent().addClass('position-absolute w-100'); 1993 } 1994 1995 $window.afterResize(function() { 1996 self.options.wrapper.removeAttr('style').removeData('pin'); 1997 self.options.wrapper.pin(self.options); 1998 $window.trigger('scroll'); 1999 }); 2000 2001 // Change Logo Src 2002 if( self.options.wrapper.find('img').attr('data-change-src') ) { 2003 var $logo = self.options.wrapper.find('img'), 2004 logoSrc = $logo.attr('src'), 2005 logoNewSrc = $logo.attr('data-change-src'); 2006 2007 self.changeLogoSrc = function(activate) { 2008 if(activate) { 2009 $logo.attr('src', logoNewSrc); 2010 } else { 2011 $logo.attr('src', logoSrc); 2012 } 2013 } 2014 } 2015 2016 return this; 2017 }, 2018 2019 events: function() { 2020 var self = this, 2021 $window = $(window), 2022 $logo = self.options.wrapper.find('img'), 2023 sticky_activate_flag = true, 2024 sticky_deactivate_flag = false, 2025 class_to_check = ( self.options.wrapper.hasClass('sticky-wrapper-effect-1') ) ? 'sticky-effect-active' : 'sticky-active'; 2026 2027 $window.on('scroll sticky.effect.active', function(){ 2028 if( self.options.wrapper.hasClass( class_to_check ) ) { 2029 if( sticky_activate_flag ) { 2030 if( $logo.attr('data-change-src') ) { 2031 self.changeLogoSrc(true); 2032 } 2033 2034 sticky_activate_flag = false; 2035 sticky_deactivate_flag = true; 2036 } 2037 } else { 2038 if( sticky_deactivate_flag ) { 2039 if( $logo.attr('data-change-src') ) { 2040 self.changeLogoSrc(false); 2041 } 2042 2043 sticky_deactivate_flag = false; 2044 sticky_activate_flag = true; 2045 } 2046 } 2047 }); 2048 2049 var is_backing = false; 2050 if( self.options.stickyStartEffectAt ) { 2051 2052 // First Load 2053 if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 2054 self.options.wrapper.addClass('sticky-effect-active'); 2055 2056 $window.trigger('sticky.effect.active'); 2057 } 2058 2059 $window.on('scroll', function(){ 2060 if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 2061 self.options.wrapper.addClass('sticky-effect-active'); 2062 is_backing = true; 2063 2064 $window.trigger('sticky.effect.active'); 2065 } else { 2066 if( is_backing ) { 2067 self.options.wrapper.find('.sticky-body').addClass('position-fixed'); 2068 is_backing = false; 2069 } 2070 2071 if( $window.scrollTop() == 0 ) { 2072 self.options.wrapper.find('.sticky-body').removeClass('position-fixed'); 2073 } 2074 2075 self.options.wrapper.removeClass('sticky-effect-active'); 2076 } 2077 }); 2078 } 2079 } 2080 }; 2081 2082 // expose to scope 2083 $.extend(theme, { 2084 PluginSticky: PluginSticky 2085 }); 2086 2087 // jquery plugin 2088 $.fn.themePluginSticky = function(opts) { 2089 return this.map(function() { 2090 var $this = $(this); 2091 2092 if ($this.data(instanceName)) { 2093 return $this.data(instanceName); 2094 } else { 2095 return new PluginSticky($this, opts); 2096 } 2097 2098 });
2099 } 2100 2101}).apply(this, [ window.theme, jQuery ]); 2102 2103// Toggle 2104(function(theme, $) { 2105 2106 theme = theme || {}; 2107 2108 var instanceName = '__toggle'; 2109 2110 var PluginToggle = function($el, opts) { 2111 return this.initialize($el, opts); 2112 }; 2113 2114 PluginToggle.defaults = { 2115 duration: 350, 2116 isAccordion: false 2117 }; 2118 2119 PluginToggle.prototype = { 2120 initialize: function($el, opts) { 2121 if ($el.data(instanceName)) { 2122 return this; 2123 } 2124 2125 this.$el = $el; 2126 2127 this 2128 .setData() 2129 .setOptions(opts) 2130 .build(); 2131 2132 return this; 2133 }, 2134 2135 setData: function() { 2136 this.$el.data(instanceName, this); 2137 2138 return this; 2139 }, 2140 2141 setOptions: function(opts) { 2142 this.options = $.extend(true, {}, PluginToggle.defaults, opts, { 2143 wrapper: this.$el 2144 }); 2145 2146 return this; 2147 }, 2148 2149 build: function() { 2150 var self = this, 2151 $wrapper = this.options.wrapper, 2152 $items = $wrapper.find('> .toggle'), 2153 $el = null; 2154 2155 $items.each(function() { 2156 $el = $(this); 2157 2158 if ($el.hasClass('active')) { 2159 $el.find('> p').addClass('preview-active'); 2160 $el.find('> .toggle-content').slideDown(self.options.duration); 2161 } 2162 2163 self.events($el); 2164 }); 2165 2166 if (self.options.isAccordion) { 2167 self.options.duration = self.options.duration / 2; 2168 } 2169 2170 return this; 2171 }, 2172 2173 events: function($el) { 2174 var self = this, 2175 previewParCurrentHeight = 0, 2176 previewParAnimateHeight = 0, 2177 toggleContent = null; 2178 2179 $el.find('> label, > .toggle-title').click(function(e) { 2180 2181 var $this = $(this), 2182 parentSection = $this.parent(), 2183 parentWrapper = $this.parents('.toggle'), 2184 previewPar = null, 2185 closeElement = null; 2186 2187 if (self.options.isAccordion && typeof(e.originalEvent) != 'undefined') { 2188 closeElement = parentWrapper.find('.toggle.active > label, .toggle.active > .toggle-title'); 2189 2190 if (closeElement[0] == $this[0]) { 2191 return; 2192 } 2193 } 2194 2195 parentSection.toggleClass('active'); 2196 2197 // Preview Paragraph 2198 if (parentSection.find('> p').get(0)) { 2199 2200 previewPar = parentSection.find('> p'); 2201 previewParCurrentHeight = previewPar.css('height'); 2202 previewPar.css('height', 'auto'); 2203 previewParAnimateHeight = previewPar.css('height'); 2204 previewPar.css('height', previewParCurrentHeight); 2205 2206 } 2207 2208 // Content 2209 toggleContent = parentSection.find('> .toggle-content'); 2210 2211 if (parentSection.hasClass('active')) { 2212 2213 $(previewPar).animate({ 2214 height: previewParAnimateHeight 2215 }, self.options.duration, function() { 2216 $(this).addClass('preview-active'); 2217 }); 2218 2219 toggleContent.slideDown(self.options.duration, function() { 2220 if (closeElement) { 2221 closeElement.trigger('click'); 2222 } 2223 }); 2224 2225 } else { 2226 2227 $(previewPar).animate({ 2228 height: 0 2229 }, self.options.duration, function() { 2230 $(this).removeClass('preview-active'); 2231 }); 2232 2233 toggleContent.slideUp(self.options.duration); 2234 2235 } 2236 2237 }); 2238 } 2239 }; 2240 2241 // expose to scope 2242 $.extend(theme, { 2243 PluginToggle: PluginToggle 2244 }); 2245 2246 // jquery plugin 2247 $.fn.themePluginToggle = function(opts) { 2248 return this.map(function() { 2249 var $this = $(this); 2250 2251 if ($this.data(instanceName)) { 2252 return $this.data(instanceName); 2253 } else { 2254 return new PluginToggle($this, opts); 2255 } 2256 2257 }); 2258 } 2259 2260}).apply(this, [window.theme, jQuery]); 2261 2262// Validation 2263(function(theme, $) { 2264 2265 theme = theme || {}; 2266 2267 $.extend(theme, { 2268 2269 PluginValidation: { 2270 2271 defaults: { 2272 formClass: 'needs-validation', 2273 validator: { 2274 highlight: function(element) { 2275 $(element) 2276 .addClass('is-invalid') 2277 .removeClass('is-valid') 2278 .parent() 2279 .removeClass('has-success') 2280 .addClass('has-danger'); 2281 }, 2282 success: function(label, element) { 2283 $(element) 2284 .removeClass('is-invalid') 2285 .addClass('is-valid') 2286 .parent() 2287 .removeClass('has-danger') 2288 .addClass('has-success') 2289 .find('label.error') 2290 .remove(); 2291 }, 2292 errorPlacement: function(error, element) { 2293 if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') { 2294 error.appendTo(element.parent().parent()); 2295 } else { 2296 error.insertAfter(element); 2297 } 2298 } 2299 }, 2300 validateCaptchaURL: 'php/contact-form-verify-captcha.php', 2301 refreshCaptchaURL: 'php/contact-form-refresh-captcha.php' 2302 }, 2303 2304 initialize: function(opts) { 2305 initialized = true; 2306 2307 this 2308 .setOptions(opts) 2309 .build(); 2310 2311 return this; 2312 }, 2313 2314 setOptions: function(opts) { 2315 this.options = $.extend(true, {}, this.defaults, opts); 2316 2317 return this; 2318 }, 2319 2320 build: function() { 2321 var self = this; 2322 2323 if (!($.isFunction($.validator))) { 2324 return this; 2325 } 2326 2327 self.addMethods(); 2328 self.setMessageGroups(); 2329 2330 $.validator.setDefaults(self.options.validator); 2331
2332 $('.' + self.options.formClass).validate(); 2333 2334 return this; 2335 }, 2336 2337 addMethods: function() { 2338 var self = this; 2339 2340 $.validator.addMethod('captcha', function(value, element, params) { 2341 var captchaValid = false; 2342 2343 $.ajax({ 2344 url: self.options.validateCaptchaURL, 2345 type: 'POST', 2346 async: false, 2347 dataType: 'json', 2348 data: { 2349 captcha: $.trim(value) 2350 }, 2351 success: function(data) { 2352 if (data.response == 'success') { 2353 captchaValid = true; 2354 } 2355 } 2356 }); 2357 2358 if (captchaValid) { 2359 return true; 2360 } 2361 2362 }, ''); 2363 2364 // Refresh Captcha 2365 $('#refreshCaptcha').on('click', function(e) { 2366 e.preventDefault(); 2367 $.get(self.options.refreshCaptchaURL, function(url) { 2368 $('#captcha-image').attr('src', url); 2369 }); 2370 }); 2371 2372 }, 2373 2374 setMessageGroups: function() { 2375 2376 $('.checkbox-group[data-msg-required], .radio-group[data-msg-required]').each(function() { 2377 var message = $(this).data('msg-required'); 2378 $(this).find('input').attr('data-msg-required', message); 2379 }); 2380 2381 } 2382 2383 } 2384 2385 }); 2386 2387}).apply(this, [window.theme, jQuery]); 2388 2389// Nav 2390(function(theme, $) { 2391 2392 theme = theme || {}; 2393 2394 var initialized = false; 2395 2396 $.extend(theme, { 2397 2398 Nav: { 2399 2400 defaults: { 2401 wrapper: $('#mainNav'), 2402 scrollDelay: 600, 2403 scrollAnimation: 'easeOutQuad' 2404 }, 2405 2406 initialize: function($wrapper, opts) { 2407 if (initialized) { 2408 return this; 2409 } 2410 2411 initialized = true; 2412 this.$wrapper = ($wrapper || this.defaults.wrapper); 2413 2414 this 2415 .setOptions(opts) 2416 .build() 2417 .events(); 2418 2419 return this; 2420 }, 2421 2422 setOptions: function(opts) { 2423 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 2424 2425 return this; 2426 }, 2427 2428 build: function() { 2429 var self = this, 2430 $html = $('html'), 2431 $header = $('#header'), 2432 $headerNavMain = $('#header .header-nav-main'), 2433 thumbInfoPreview; 2434 2435 // Preview Thumbs 2436 self.$wrapper.find('a[data-thumb-preview]').each(function() { 2437 thumbInfoPreview = $('<span />').addClass('thumb-info thumb-info-preview') 2438 .append($('<span />').addClass('thumb-info-wrapper') 2439 .append($('<span />').addClass('thumb-info-image').css('background-image', 'url(' + $(this).data('thumb-preview') + ')') 2440 ) 2441 ); 2442 2443 $(this).append(thumbInfoPreview); 2444 }); 2445 2446 // Side Header / Side Header Hamburguer Sidebar (Reverse Dropdown) 2447 if($html.hasClass('side-header') || $html.hasClass('side-header-hamburguer-sidebar')) { 2448 2449 // Side Header Right / Side Header Hamburguer Sidebar Right 2450 if($html.hasClass('side-header-right') || $html.hasClass('side-header-hamburguer-sidebar-right')) { 2451 if(!$html.hasClass('side-header-right-no-reverse')) { 2452 $header.find('.dropdown-submenu').addClass('dropdown-reverse'); 2453 } 2454 } 2455 2456 } else { 2457 2458 // Reverse 2459 self.checkReverse = function() { 2460 self.$wrapper.find('.dropdown, .dropdown-submenu').removeClass('dropdown-reverse'); 2461 2462 self.$wrapper.find('.dropdown:not(.manual):not(.dropdown-mega), .dropdown-submenu:not(.manual)').each(function() { 2463 if(!$(this).find('.dropdown-menu').visible( false, true, 'horizontal' ) ) { 2464 $(this).addClass('dropdown-reverse'); 2465 } 2466 }); 2467 } 2468 2469 self.checkReverse(); 2470 2471 $(window).on('resize', function() { 2472 self.checkReverse(); 2473 }); 2474 2475 } 2476 2477 // Clone Items 2478 if($headerNavMain.hasClass('header-nav-main-clone-items')) { 2479 2480 $headerNavMain.find('nav > ul > li > a').each(function(){ 2481 var parent = $(this).parent(), 2482 clone = $(this).clone(), 2483 clone2 = $(this).clone(), 2484 wrapper = $('<span class="wrapper-items-cloned"></span>'); 2485 2486 // Config Classes 2487 $(this).addClass('item-original'); 2488 clone2.addClass('item-two'); 2489 2490 // Insert on DOM
2491 parent.prepend(wrapper); 2492 wrapper.append(clone).append(clone2); 2493 }); 2494 2495 } 2496 2497 // Floating 2498 if($('#header.header-floating-icons').get(0) && $(window).width() > 991) { 2499 2500 var menuFloatingAnim = { 2501 $menuFloating: $('#header.header-floating-icons .header-container > .header-row'), 2502 2503 build: function() { 2504 var self = this; 2505 2506 self.init(); 2507 }, 2508 init: function(){ 2509 var self = this, 2510 divisor = 0; 2511 2512 $(window).scroll(function() { 2513 var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()), 2514 st = $(this).scrollTop(); 2515 2516 divisor = $(document).height() / $(window).height(); 2517 2518 self.$menuFloating.find('.header-column > .header-row').css({ 2519 transform : 'translateY( calc('+ scrollPercent +'vh - '+ st / divisor +'px) )' 2520 }); 2521 }); 2522 } 2523 } 2524 2525 menuFloatingAnim.build(); 2526 2527 } 2528 2529 // Slide 2530 if($('.header-nav-links-vertical-slide').get(0)) { 2531 var slideNavigation = { 2532 $mainNav: $('#mainNav'), 2533 $mainNavItem: $('#mainNav li'), 2534 2535 build: function(){ 2536 var self = this; 2537 2538 self.menuNav(); 2539 }, 2540 menuNav: function(){ 2541 var self = this; 2542 2543 self.$mainNavItem.on('click', function(e){ 2544 var currentMenuItem = $(this), 2545 currentMenu = $(this).parent(), 2546 nextMenu = $(this).find('ul').first(), 2547 prevMenu = $(this).closest('.next-menu'), 2548 isSubMenu = currentMenuItem.hasClass('dropdown') || currentMenuItem.hasClass('dropdown-submenu'), 2549 isBack = currentMenuItem.hasClass('back-button'), 2550 nextMenuHeightDiff = ( ( nextMenu.find('> li').length * nextMenu.find('> li').outerHeight() ) - nextMenu.outerHeight() ), 2551 prevMenuHeightDiff = ( ( prevMenu.find('> li').length * prevMenu.find('> li').outerHeight() ) - prevMenu.outerHeight() ); 2552 2553 if( isSubMenu ) { 2554 currentMenu.addClass('next-menu'); 2555 nextMenu.addClass('visible'); 2556 currentMenu.css({ 2557 overflow: 'visible', 2558 'overflow-y': 'visible' 2559 }); 2560 2561 if( nextMenuHeightDiff > 0 ) { 2562 nextMenu.css({ 2563 overflow: 'hidden', 2564 'overflow-y': 'scroll' 2565 }); 2566 } 2567 2568 for( i = 0; i < nextMenu.find('> li').length; i++ ) { 2569 if( nextMenu.outerHeight() < ($('.header-row-side-header').outerHeight() - 100) ) { 2570 nextMenu.css({ 2571 height: nextMenu.outerHeight() + nextMenu.find('> li').outerHeight() 2572 }); 2573 } 2574 } 2575 2576 nextMenu.css({ 2577 'padding-top': nextMenuHeightDiff + 'px' 2578 }); 2579 } 2580 2581 if( isBack ) { 2582 currentMenu.parent().parent().removeClass('next-menu'); 2583 currentMenu.removeClass('visible'); 2584 2585 if( prevMenuHeightDiff > 0 ) { 2586 prevMenu.css({ 2587 overflow: 'hidden', 2588 'overflow-y': 'scroll' 2589 }); 2590 } 2591 } 2592 2593 e.stopPropagation(); 2594 }); 2595 } 2596 } 2597 2598 $(window).trigger('resize'); 2599 2600 if( $(window).width() > 991 ) { 2601 slideNavigation.build(); 2602 } 2603 2604 $(document).ready(function(){ 2605 $(window).afterResize(function(){ 2606 if( $(window).width() > 991 ) { 2607 slideNavigation.build(); 2608 } 2609 }); 2610 }); 2611 } 2612 2613 // Header Nav Main Mobile Dark 2614 if($('.header-nav-main-mobile-dark').get(0)) { 2615 $('#header:not(.header-transparent-dark-bottom-border):not(.header-transparent-light-bottom-border)').addClass('header-no-border-bottom'); 2616 } 2617 2618 return this; 2619 }, 2620 2621 events: function() { 2622 var self = this, 2623 $html = $('html'), 2624 $header = $('#header'), 2625 $window = $(window), 2626 headerBodyHeight = $('.header-body').outerHeight(); 2627 2628 $header.find('a[href="#"]').on('click', function(e) { 2629 e.preventDefault(); 2630 }); 2631 2632 // Mobile Arrows 2633 $header.find('.dropdown-toggle, .dropdown-submenu > a') 2634 .append('<i class="fas fa-chevron-down"></i>'); 2635 2636 $header.find('.dropdown-toggle[href="#"], .dropdown-submenu a[href="#"], .dropdown-toggle[href!="#"] .fa-chevron-down, .dropdown-submenu a[href!="#"] .fa-chevron-down').on('click', function(e) { 2637 e.preventDefault(); 2638 if ($window.width() < 992) { 2639 $(this).closest('li').toggleClass('open'); 2640 2641 // Adjust Header Body Height 2642 var height = ( $header.hasClass('header-effect-shrink') && $html.hasClass('sticky-header-active') ) ? theme.StickyHeader.options.stickyHeaderContainerHeight : headerBodyHeight; 2643 $('.header-body').animate({ 2644 height: ($('.header-nav-main nav').outerHeight(true) + height) + 10 2645 }, 0); 2646 } 2647 }); 2648 2649 $header.find('li a.active').addClass('current-page-active'); 2650 2651 // Add Open Class 2652 $header.find('.header-nav-click-to-open .dropdown-toggle[href="#"], .header-nav-click-to-open .dropdown-submenu a[href="#"], .header-nav-click-to-open .dropdown-toggle > i').on('click', function(e) { 2653 e.preventDefault(); 2654 e.stopPropagation(); 2655 if ($window.width() > 991) { 2656 2657 $header.find('li a.active').removeClass('active'); 2658 2659 if( $(this).prop('tagName') == 'I' ) { 2660 $(this).parent().addClass('active'); 2661 } else { 2662 $(this).addClass('active'); 2663 } 2664 2665 if (!$(this).closest('li').hasClass('open')) { 2666 2667 var $li = $(this).closest('li'), 2668 isSub = false; 2669 2670 if ( $(this).parent().hasClass('dropdown-submenu') ) { 2671 isSub = true; 2672 } 2673 2674 $(this).closest('.dropdown-menu').find('.dropdown-submenu.open').removeClass('open'); 2675 $(this).parent('.dropdown').parent().find('.dropdown.open').removeClass('open'); 2676 2677 if (!isSub) { 2678 $(this).parent().find('.dropdown-submenu.open').removeClass('open'); 2679 } 2680 2681 $li.addClass('open'); 2682
2683 $(document).off('click.nav-click-to-open').on('click.nav-click-to-open', function (e) { 2684 if (!$li.is(e.target) && $li.has(e.target).length === 0) { 2685 $li.removeClass('open'); 2686 $li.parents('.open').removeClass('open'); 2687 $header.find('li a.active').removeClass('active'); 2688 $header.find('li a.current-page-active').addClass('active'); 2689 } 2690 }); 2691 2692 } else { 2693 $(this).closest('li').removeClass('open'); 2694 $header.find('li a.active').removeClass('active'); 2695 $header.find('li a.current-page-active').addClass('active'); 2696 } 2697 2698 $window.trigger({ 2699 type: 'resize', 2700 from: 'header-nav-click-to-open' 2701 }); 2702 } 2703 }); 2704 2705 // Collapse Nav 2706 $header.find('[data-collapse-nav]').on('click', function(e) { 2707 $(this).parents('.collapse').removeClass('show'); 2708 }); 2709 2710 // Top Features 2711 $header.find('.header-nav-features-toggle').on('click', function(e) { 2712 e.preventDefault(); 2713 2714 var $toggleParent = $(this).parent(); 2715 2716 if (!$(this).siblings('.header-nav-features-dropdown').hasClass('show')) { 2717 2718 var $dropdown = $(this).siblings('.header-nav-features-dropdown'); 2719 2720 $('.header-nav-features-dropdown.show').removeClass('show'); 2721 2722 $dropdown.addClass('show'); 2723 2724 $(document).off('click.header-nav-features-toggle').on('click.header-nav-features-toggle', function (e) { 2725 if (!$toggleParent.is(e.target) && $toggleParent.has(e.target).length === 0) { 2726 $('.header-nav-features-dropdown.show').removeClass('show'); 2727 } 2728 }); 2729 2730 if ($(this).attr('data-focus')) { 2731 $('#' + $(this).attr('data-focus')).focus(); 2732 } 2733 2734 } else { 2735 $(this).siblings('.header-nav-features-dropdown').removeClass('show'); 2736 } 2737 }); 2738 2739 // Hamburguer Menu 2740 var $hamburguerMenuBtn = $('.hamburguer-btn:not(.side-panel-toggle)'), 2741 $hamburguerSideHeader = $('#header.side-header, #header.side-header-overlay-full-screen'); 2742 2743 $hamburguerMenuBtn.on('click', function(){ 2744 if($(this).attr('data-set-active') != 'false') { 2745 $(this).toggleClass('active'); 2746 } 2747 $hamburguerSideHeader.toggleClass('side-header-hide'); 2748 $html.toggleClass('side-header-hide'); 2749 2750 $window.trigger('resize'); 2751 }); 2752 2753 $('.hamburguer-close:not(.side-panel-toggle)').on('click', function(){ 2754 $('.hamburguer-btn:not(.hamburguer-btn-side-header-mobile-show)').trigger('click'); 2755 }); 2756 2757 // Set Header Body Height when open mobile menu 2758 $('.header-nav-main nav').on('show.bs.collapse', function () { 2759 $(this).removeClass('closed'); 2760 2761 // Add Mobile Menu Opened Class 2762 $('html').addClass('mobile-menu-opened'); 2763 2764 $('.header-body').animate({ 2765 height: ($('.header-body').outerHeight() + $('.header-nav-main nav').outerHeight(true)) + 10 2766 }); 2767 2768 // Header Below Slider / Header Bottom Slider - Scroll to menu position 2769 if( $('#header').is('.header-bottom-slider, .header-below-slider') && !$('html').hasClass('sticky-header-active') ) { 2770 self.scrollToTarget( $('#header'), 0 ); 2771 } 2772 }); 2773 2774 // Set Header Body Height when collapse mobile menu 2775 $('.header-nav-main nav').on('hide.bs.collapse', function () { 2776 $(this).addClass('closed'); 2777 2778 // Remove Mobile Menu Opened Class 2779 $('html').removeClass('mobile-menu-opened'); 2780 2781 $('.header-body').animate({ 2782 height: ($('.header-body').outerHeight() - $('.header-nav-main nav').outerHeight(true)) 2783 }, function(){ 2784 $(this).height('auto'); 2785 }); 2786 }); 2787 2788 // Header Effect Shrink - Adjust header body height on mobile 2789 $window.on('stickyHeader.activate', function(){ 2790 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) { 2791 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) { 2792 $('.header-body').animate({ 2793 height: ( $('.header-nav-main nav').outerHeight(true) + theme.StickyHeader.options.stickyHeaderContainerHeight ) + ( ($('.header-nav-bar').get(0)) ? $('.header-nav-bar').outerHeight() : 0 ) 2794 }); 2795 } 2796 } 2797 }); 2798 2799 $window.on('stickyHeader.deactivate', function(){ 2800 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) { 2801 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) { 2802 $('.header-body').animate({ 2803 height: headerBodyHeight + $('.header-nav-main nav').outerHeight(true) + 10 2804 }); 2805 } 2806 } 2807 }); 2808 2809 // Remove Open Class on Resize 2810 $window.on('resize.removeOpen', function(e) { 2811 if( e.from == 'header-nav-click-to-open' ) { 2812 return; 2813 } 2814 2815 setTimeout(function() { 2816 if( $window.width() > 991 ) { 2817 $header.find('.dropdown.open').removeClass('open'); 2818 } 2819 }, 100); 2820 }); 2821 2822 // Side Header - Change value of initial header body height 2823 $(document).ready(function(){ 2824 if( $window.width() > 991 ) { 2825 var flag = false; 2826 2827 $window.on('resize', function(e) { 2828 if( e.from == 'header-nav-click-to-open' ) { 2829 return; 2830 } 2831 2832 $header.find('.dropdown.open').removeClass('open'); 2833 2834 if( $window.width() < 992 && flag == false ) { 2835 headerBodyHeight = $('.header-body').outerHeight(); 2836 flag = true; 2837 2838 setTimeout(function(){ 2839 flag = false; 2840 }, 500); 2841 } 2842 }); 2843 } 2844 }); 2845 2846 // Side Header - Set header height on mobile 2847 if( $html.hasClass('side-header') ) { 2848 if( $window.width() < 992 ) { 2849 $header.css({ 2850 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') )) 2851 }); 2852 } 2853 2854 $(document).ready(function(){ 2855 $window.afterResize(function(){ 2856 if( $window.width() < 992 ) { 2857 $header.css({ 2858 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') )) 2859 }); 2860 } else { 2861 $header.css({ 2862 height: '' 2863 }); 2864 } 2865 }); 2866 }); 2867 } 2868 2869 // Anchors Position 2870 $('[data-hash]').each(function() { 2871 2872 var target = $(this).attr('href'), 2873 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0); 2874 2875 if($(target).get(0)) { 2876 $(this).on('click', function(e) { 2877 e.preventDefault(); 2878 2879 if( !$(e.target).is('i') ) { 2880 2881 // Close Collapse if open 2882 $(this).parents('.collapse.show').collapse('hide'); 2883 2884 // Close Side Header 2885 $hamburguerSideHeader.addClass('side-header-hide'); 2886 $html.addClass('side-header-hide'); 2887 2888 $window.trigger('resize'); 2889 2890 self.scrollToTarget(target, offset); 2891 2892 } 2893 2894 return; 2895 }); 2896 } 2897 2898 }); 2899 2900 // Floating 2901 if($('#header.header-floating-icons').get(0)) { 2902 2903 $('#header.header-floating-icons [data-hash]').off().each(function() { 2904 2905 var target = $(this).attr('href'), 2906 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0); 2907 2908 if($(target).get(0)) { 2909 $(this).on('click', function(e) { 2910 e.preventDefault(); 2911 2912 $('html, body').animate({ 2913 scrollTop: $(target).offset().top - offset 2914 }, 600, 'easeOutQuad', function() { 2915 2916 }); 2917 2918 return; 2919 }); 2920 } 2921 2922 }); 2923 2924 } 2925 2926 // Side Panel Toggle 2927 if( $('.side-panel-toggle').get(0) ) { 2928 var init_html_class = $('html').attr('class'); 2929 2930 $('.side-panel-toggle').on('click', function(e){
2931 var extra_class = $(this).data('extra-class'), 2932 delay = ( extra_class ) ? 100 : 0; 2933 2934 e.preventDefault(); 2935 2936 if( $(this).hasClass('active') ) { 2937 $('html').removeClass('side-panel-open'); 2938 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active'); 2939 return false; 2940 } 2941 2942 if( extra_class ) { 2943 $('.side-panel-wrapper').css('transition','none'); 2944 $('html') 2945 .removeClass() 2946 .addClass( init_html_class ) 2947 .addClass( extra_class ); 2948 } 2949 2950 setTimeout(function(){ 2951 $('.side-panel-wrapper').css('transition',''); 2952 $('html').toggleClass('side-panel-open'); 2953 }, delay); 2954 }); 2955 2956 $(document).on('click', function(e){ 2957 if( !$(e.target).closest('.side-panel-wrapper').get(0) && !$(e.target).hasClass('side-panel-toggle') ) { 2958 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active'); 2959 $('html').removeClass('side-panel-open'); 2960 } 2961 }); 2962 } 2963 2964 return this; 2965 }, 2966 2967 scrollToTarget: function(target, offset) { 2968 var self = this; 2969 2970 $('body').addClass('scrolling'); 2971 2972 $('html, body').animate({ 2973 scrollTop: $(target).offset().top - offset 2974 }, self.options.scrollDelay, self.options.scrollAnimation, function() { 2975 $('body').removeClass('scrolling'); 2976 }); 2977 2978 return this; 2979 2980 } 2981 2982 } 2983 2984 }); 2985 2986}).apply(this, [window.theme, jQuery]); 2987 2988// Newsletter 2989(function(theme, $) { 2990 2991 theme = theme || {}; 2992 2993 var initialized = false; 2994 2995 $.extend(theme, { 2996 2997 Newsletter: { 2998 2999 defaults: { 3000 wrapper: $('#newsletterForm') 3001 }, 3002 3003 initialize: function($wrapper, opts) { 3004 if (initialized) { 3005 return this; 3006 } 3007 3008 initialized = true; 3009 this.$wrapper = ($wrapper || this.defaults.wrapper); 3010 3011 this 3012 .setOptions(opts) 3013 .build(); 3014 3015 return this; 3016 }, 3017 3018 setOptions: function(opts) { 3019 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 3020 3021 return this; 3022 }, 3023 3024 build: function() { 3025 if (!($.isFunction($.fn.validate))) { 3026 return this; 3027 } 3028 3029 var self = this, 3030 $email = self.$wrapper.find('#newsletterEmail'), 3031 $success = $('#newsletterSuccess'), 3032 $error = $('#newsletterError'); 3033 3034 self.$wrapper.validate({ 3035 submitHandler: function(form) { 3036 3037 $.ajax({
3038 type: 'POST', 3039 url: self.$wrapper.attr('action'), 3040 data: { 3041 'email': $email.val() 3042 }, 3043 dataType: 'json', 3044 success: function(data) { 3045 if (data.response == 'success') { 3046 3047 $success.removeClass('d-none'); 3048 $error.addClass('d-none'); 3049 3050 $email 3051 .val('') 3052 .blur() 3053 .closest('.control-group') 3054 .removeClass('success') 3055 .removeClass('error'); 3056 3057 } else { 3058 3059 $error.html(data.message); 3060 $error.removeClass('d-none'); 3061 $success.addClass('d-none'); 3062 3063 $email 3064 .blur() 3065 .closest('.control-group') 3066 .removeClass('success') 3067 .addClass('error'); 3068 3069 } 3070 } 3071 }); 3072 3073 }, 3074 rules: { 3075 newsletterEmail: { 3076 required: true, 3077 email: true 3078 } 3079 }, 3080 errorPlacement: function(error, element) { 3081 3082 } 3083 }); 3084 3085 return this; 3086 } 3087 3088 } 3089 3090 }); 3091 3092}).apply(this, [window.theme, jQuery]); 3093 3094 3095// Carousel 3096(function(theme, $) { 3097 3098 theme = theme || {}; 3099 3100 var instanceName = '__carousel'; 3101 3102 var PluginCarousel = function($el, opts) { 3103 return this.initialize($el, opts); 3104 }; 3105 3106 PluginCarousel.defaults = { 3107 loop: true, 3108 responsive: { 3109 0: { 3110 items: 1 3111 }, 3112 479: { 3113 items: 1 3114 }, 3115 768: { 3116 items: 2 3117 }, 3118 979: { 3119 items: 3 3120 }, 3121 1199: { 3122 items: 4 3123 } 3124 }, 3125 navText: [] 3126 }; 3127 3128 PluginCarousel.prototype = { 3129 initialize: function($el, opts) { 3130 if ($el.data(instanceName)) { 3131 return this; 3132 } 3133 3134 this.$el = $el; 3135 3136 this 3137 .setData() 3138 .setOptions(opts) 3139 .build(); 3140 3141 return this; 3142 }, 3143 3144 setData: function() { 3145 this.$el.data(instanceName, this); 3146 3147 return this; 3148 }, 3149 3150 setOptions: function(opts) { 3151 this.options = $.extend(true, {}, PluginCarousel.defaults, opts, { 3152 wrapper: this.$el 3153 }); 3154 3155 return this; 3156 }, 3157 3158 build: function() { 3159 if (!($.isFunction($.fn.owlCarousel))) { 3160 return this; 3161 } 3162 3163 var self = this, 3164 $el = this.options.wrapper; 3165 3166 // Add Theme Class 3167 $el.addClass('owl-theme'); 3168 3169 // Add Loading 3170 $el.addClass('owl-loading'); 3171 3172 // Force RTL according to HTML dir attribute 3173 if ($('html').attr('dir') == 'rtl') { 3174 this.options = $.extend(true, {}, this.options, { 3175 rtl: true 3176 }); 3177 } 3178 3179 if (this.options.items == 1) { 3180 this.options.responsive = {} 3181 } 3182 3183 if (this.options.items > 4) { 3184 this.options = $.extend(true, {}, this.options, { 3185 responsive: { 3186 1199: { 3187 items: this.options.items 3188 } 3189 } 3190 }); 3191 } 3192 3193 // Auto Height Fixes 3194 if (this.options.autoHeight) { 3195 var itemsHeight = []; 3196 3197 $el.find('.owl-item').each(function(){ 3198 if( $(this).hasClass('active') ) { 3199 itemsHeight.push( $(this).height() ); 3200 } 3201 }); 3202 3203 $(window).afterResize(function() { 3204 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 3205 }); 3206 3207 $(window).on('load', function() { 3208 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 3209 }); 3210 } 3211 3212 // Initialize OwlCarousel 3213 $el.owlCarousel(this.options).addClass('owl-carousel-init'); 3214 3215 // Sync 3216 if ($el.attr('data-sync')) { 3217 $el.on('change.owl.carousel', function(event) { 3218 if (event.namespace && event.property.name === 'position') { 3219 var target = event.relatedTarget.relative(event.property.value, true); 3220 $( $el.data('sync') ).owlCarousel('to', target, 300, true); 3221 } 3222 }); 3223 } 3224 3225 // Carousel Center Active Item 3226 if( $el.hasClass('carousel-center-active-item') ) { 3227 var itemsActive = $el.find('.owl-item.active'), 3228 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
3229 itemCenter = itemsActive.eq(indexCenter); 3230 3231 itemCenter.addClass('current'); 3232 3233 $el.on('change.owl.carousel', function(event) { 3234 $el.find('.owl-item').removeClass('current'); 3235 3236 setTimeout(function(){ 3237 var itemsActive = $el.find('.owl-item.active'), 3238 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ), 3239 itemCenter = itemsActive.eq(indexCenter); 3240 3241 itemCenter.addClass('current'); 3242 }, 100); 3243 }); 3244 3245 // Refresh 3246 $el.trigger('refresh.owl.carousel'); 3247 3248 } 3249 3250 // Remove Loading 3251 $el.removeClass('owl-loading'); 3252 3253 // Remove Height 3254 $el.css('height', 'auto'); 3255 3256 return this; 3257 } 3258 }; 3259 3260 // expose to scope 3261 $.extend(theme, { 3262 PluginCarousel: PluginCarousel 3263 }); 3264 3265 // jquery plugin 3266 $.fn.themePluginCarousel = function(opts) { 3267 return this.map(function() { 3268 var $this = $(this); 3269 3270 if ($this.data(instanceName)) { 3271 return $this.data(instanceName); 3272 } else { 3273 return new PluginCarousel($this, opts); 3274 } 3275 3276 }); 3277 } 3278 3279}).apply(this, [window.theme, jQuery]); 3280 3281// Search 3282(function(theme, $) { 3283 3284 theme = theme || {}; 3285 3286 var initialized = false; 3287 3288 $.extend(theme, { 3289 3290 Search: { 3291 3292 defaults: { 3293 wrapper: $('#searchForm') 3294 }, 3295 3296 initialize: function($wrapper, opts) { 3297 if (initialized) { 3298 return this; 3299 } 3300 3301 initialized = true; 3302 this.$wrapper = ($wrapper || this.defaults.wrapper); 3303 3304 this 3305 .setOptions(opts) 3306 .build(); 3307 3308 return this; 3309 }, 3310 3311 setOptions: function(opts) { 3312 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 3313 3314 return this; 3315 }, 3316 3317 build: function() { 3318 if (!($.isFunction($.fn.validate))) { 3319 return this; 3320 } 3321 3322 this.$wrapper.validate({ 3323 errorPlacement: function(error, element) {} 3324 }); 3325 3326 // Search Reveal 3327 $('.header-nav-features-search-reveal').each(function() { 3328 3329 var $el = $(this) 3330 $header = $('#header'), 3331 $html = $('htmnl'); 3332 3333 $el.find('.header-nav-features-search-show-icon').on('click', function() { 3334 $el.addClass('show'); 3335 $header.addClass('search-show'); 3336 $html.addClass('search-show'); 3337 $('#headerSearch').focus(); 3338 }); 3339 3340 $el.find('.header-nav-features-search-hide-icon').on('click', function() { 3341 $el.removeClass('show'); 3342 $header.removeClass('search-show'); 3343 $html.removeClass('search-show'); 3344 }); 3345 3346 }); 3347 3348 return this; 3349 } 3350 3351 } 3352 3353 }); 3354 3355}).apply(this, [window.theme, jQuery]); 3356 3357// Sticky Header 3358(function(theme, $) { 3359 3360 theme = theme || {}; 3361 3362 var initialized = false; 3363 3364 $.extend(theme, { 3365 3366 StickyHeader: { 3367 3368 defaults: { 3369 wrapper: $('#header'), 3370 headerBody: $('#header .header-body'), 3371 stickyEnabled: true, 3372 stickyEnableOnBoxed: true, 3373 stickyEnableOnMobile: true, 3374 stickyStartAt: 0, 3375 stickyStartAtElement: false, 3376 stickySetTop: 0, 3377 stickyEffect: '', 3378 stickyHeaderContainerHeight: false, 3379 stickyChangeLogo: false, 3380 stickyChangeLogoWrapper: true 3381 }, 3382 3383 initialize: function($wrapper, opts) { 3384 if (initialized) { 3385 return this; 3386 } 3387 3388 initialized = true; 3389 this.$wrapper = ($wrapper || this.defaults.wrapper); 3390 3391 this 3392 .setOptions(opts) 3393 .build() 3394 .events(); 3395 3396 return this; 3397 }, 3398 3399 setOptions: function(opts) { 3400 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 3401 3402 return this; 3403 }, 3404 3405 build: function() { 3406 if (!this.options.stickyEnableOnBoxed && $('html').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') || !this.options.stickyEnabled) { 3407 return this; 3408 } 3409 3410 var self = this, 3411 $html = $('html'), 3412 $window = $(window), 3413 sideHeader = $html.hasClass('side-header'), 3414 initialHeaderTopHeight = self.options.wrapper.find('.header-top').outerHeight(), 3415 initialHeaderContainerHeight = self.options.wrapper.find('.header-container').outerHeight(), 3416 minHeight; 3417 3418 // HTML Classes 3419 $html.addClass('sticky-header-enabled'); 3420 3421 if (parseInt(self.options.stickySetTop) < 0) { 3422 $html.addClass('sticky-header-negative'); 3423 } 3424 3425 // Set Start At 3426 if(self.options.stickyStartAtElement) { 3427 3428 var $stickyStartAtElement = $(self.options.stickyStartAtElement); 3429 3430 $(window).on('scroll resize', function() { 3431 self.options.stickyStartAt = $stickyStartAtElement.offset().top; 3432 }); 3433 3434 $(window).trigger('resize'); 3435 } 3436 3437 // Define Min Height value 3438 if( self.options.wrapper.find('.header-top').get(0) ) { 3439 minHeight = ( initialHeaderTopHeight + initialHeaderContainerHeight ); 3440 } else { 3441 minHeight = initialHeaderContainerHeight; 3442 } 3443 3444 // Set Wrapper Min-Height 3445 if( !sideHeader ) { 3446 if( !$('.header-logo-sticky-change').get(0) ) { 3447 self.options.wrapper.css('height', self.options.headerBody.outerHeight()); 3448 } else { 3449 $window.on('stickyChangeLogo.loaded', function(){ 3450 self.options.wrapper.css('height', self.options.headerBody.outerHeight()); 3451 }); 3452 } 3453 3454 if( self.options.stickyEffect == 'shrink' ) { 3455 3456 // Prevent wrong visualization of header when reload on middle of page 3457 $(document).ready(function(){ 3458 if( $window.scrollTop() >= self.options.stickyStartAt ) { 3459 self.options.wrapper.find('.header-container').on('transitionend webkitTransitionEnd oTransitionEnd', function(){ 3460 self.options.headerBody.css('position', 'fixed'); 3461 }); 3462 } else { 3463 self.options.headerBody.css('position', 'fixed'); 3464 } 3465 }); 3466 3467 self.options.wrapper.find('.header-container').css('height', initialHeaderContainerHeight); 3468 self.options.wrapper.find('.header-top').css('height', initialHeaderTopHeight); 3469 } 3470 } 3471 3472 // Sticky Header Container Height 3473 if( self.options.stickyHeaderContainerHeight ) { 3474 self.options.wrapper.find('.header-container').css('height', self.options.wrapper.find('.header-container').outerHeight()); 3475 } 3476 3477 // Boxed 3478 if($html.hasClass('boxed') && self.options.stickyEffect == 'shrink') { 3479 if( (parseInt(self.options.stickyStartAt) == 0) && $window.width() > 991) { 3480 self.options.stickyStartAt = 30; 3481 } 3482 3483 // Set Header Body Position Absolute 3484 self.options.headerBody.css('position','absolute'); 3485 3486 // Set position absolute because top margin from boxed layout 3487 $window.on('scroll', function(){ 3488 if( $window.scrollTop() > $('.body').offset().top ) { 3489 self.options.headerBody.css({ 3490 'position' : 'fixed', 3491 'top' : 0 3492 }); 3493 } else { 3494 self.options.headerBody.css({ 3495 'position' : 'absolute', 3496 'top' : 0 3497 }); 3498 } 3499 }); 3500 } 3501 3502 // Check Sticky Header / Flags prevent multiple runs at same time 3503 var activate_flag = true, 3504 deactivate_flag = false; 3505 3506 self.checkStickyHeader = function() { 3507 if( $window.width() > 991 && $html.hasClass('side-header') ) { 3508 $html.removeClass('sticky-header-active'); 3509 activate_flag = true; 3510 return; 3511 } 3512 3513 if ($window.scrollTop() >= parseInt(self.options.stickyStartAt)) { 3514 if( activate_flag ) { 3515 self.activateStickyHeader(); 3516 activate_flag = false; 3517 deactivate_flag = true; 3518 } 3519 } else { 3520 if( deactivate_flag ) { 3521 self.deactivateStickyHeader(); 3522 deactivate_flag = false; 3523 activate_flag = true; 3524 } 3525 } 3526 }; 3527 3528 // Activate Sticky Header 3529 self.activateStickyHeader = function() { 3530 3531 if ($window.width() < 992) { 3532 if (!self.options.stickyEnableOnMobile) { 3533 self.deactivateStickyHeader(); 3534 return; 3535 } 3536 } else { 3537 if (sideHeader) { 3538 self.deactivateStickyHeader(); 3539 return; 3540 } 3541 } 3542 3543 $html.addClass('sticky-header-active'); 3544 3545 // Sticky Effect - Reveal 3546 if( self.options.stickyEffect == 'reveal' ) { 3547 3548 self.options.headerBody.css('top','-' + self.options.stickyStartAt + 'px'); 3549 3550 self.options.headerBody.animate({ 3551 top: self.options.stickySetTop 3552 }, 400, function() {}); 3553 3554 } 3555 3556 // Sticky Effect - Shrink 3557 if( self.options.stickyEffect == 'shrink' ) { 3558 3559 // If Header Top 3560 if( self.options.wrapper.find('.header-top').get(0) ) { 3561 self.options.wrapper.find('.header-top').css({ 3562 height: 0, 3563 'min-height': 0, 3564 overflow: 'hidden' 3565 }); 3566 } 3567 3568 // Header Container 3569 if( self.options.stickyHeaderContainerHeight ) { 3570 self.options.wrapper.find('.header-container').css({ 3571 height: self.options.stickyHeaderContainerHeight, 3572 'min-height': 0 3573 }); 3574 } else { 3575 self.options.wrapper.find('.header-container').css({ 3576 height: (initialHeaderContainerHeight / 3) * 2, // two third of container height 3577 'min-height': 0 3578 }); 3579 3580 var y = initialHeaderContainerHeight - ((initialHeaderContainerHeight / 3) * 2); 3581 $('.main').css({ 3582 transform: 'translate3d(0, -'+ y +'px, 0)', 3583 transition: 'ease transform 300ms' 3584 }); 3585 3586 if($html.hasClass('boxed')) { 3587 self.options.headerBody.css('position','fixed'); 3588 } 3589 } 3590 3591 } 3592 3593 self.options.headerBody.css('top', self.options.stickySetTop); 3594 3595 if (self.options.stickyChangeLogo) { 3596 self.changeLogo(true); 3597 } 3598 3599 // Set Elements Style 3600 $('[data-sticky-header-style]').each(function() { 3601 var $el = $(this), 3602 css = theme.fn.getOptions($el.data('sticky-header-style-active')), 3603 opts = theme.fn.getOptions($el.data('sticky-header-style')); 3604 3605 if( $window.width() > opts.minResolution ) { 3606 $el.css(css); 3607 } 3608 }); 3609 3610 $.event.trigger({ 3611 type: 'stickyHeader.activate' 3612 }); 3613 }; 3614 3615 // Deactivate Sticky Header 3616 self.deactivateStickyHeader = function() { 3617 3618 $html.removeClass('sticky-header-active'); 3619 3620 // Sticky Effect - Shrink 3621 if( self.options.stickyEffect == 'shrink' ) { 3622 3623 // Boxed Layout 3624 if( $html.hasClass('boxed') ) { 3625 3626 // Set Header Body Position Absolute 3627 self.options.headerBody.css('position','absolute'); 3628 3629 if( $window.scrollTop() > $('.body').offset().top ) { 3630 // Set Header Body Position Fixed 3631 self.options.headerBody.css('position','fixed'); 3632 } 3633 3634 } else { 3635 // Set Header Body Position Fixed 3636 self.options.headerBody.css('position','fixed'); 3637 } 3638 3639 // If Header Top 3640 if( self.options.wrapper.find('.header-top').get(0) ) { 3641 self.options.wrapper.find('.header-top').css({ 3642 height: initialHeaderTopHeight, 3643 overflow: 'visible' 3644 }); 3645 } 3646 3647 // Header Container 3648 self.options.wrapper.find('.header-container').css({ 3649 height: initialHeaderContainerHeight 3650 }); 3651 3652 } 3653 3654 self.options.headerBody.css('top', 0); 3655 3656 if (self.options.stickyChangeLogo) { 3657 self.changeLogo(false); 3658 } 3659 3660 // Set Elements Style 3661 $('[data-sticky-header-style]').each(function() { 3662 var $el = $(this), 3663 css = theme.fn.getOptions($el.data('sticky-header-style-deactive')), 3664 opts = theme.fn.getOptions($el.data('sticky-header-style')); 3665 3666 if( $window.width() > opts.minResolution ) { 3667 $el.css(css); 3668 } 3669 }); 3670 3671 $.event.trigger({ 3672 type: 'stickyHeader.deactivate' 3673 }); 3674 }; 3675 3676 // Always Sticky 3677 if (parseInt(self.options.stickyStartAt) <= 0) { 3678 self.activateStickyHeader(); 3679 } 3680 3681 // Notice Top Bar 3682 if ($('.notice-top-bar').get(0)) { 3683 self.options.stickyStartAt = $('.notice-top-bar').outerHeight(); 3684 } 3685 3686 // Set Logo 3687 if (self.options.stickyChangeLogo) { 3688 3689 var $logoWrapper = self.options.wrapper.find('.header-logo'), 3690 $logo = $logoWrapper.find('img'), 3691 logoWidth = $logo.attr('width'), 3692 logoHeight = $logo.attr('height'), 3693 logoSmallTop = parseInt($logo.attr('data-sticky-top') ? $logo.attr('data-sticky-top') : 0), 3694 logoSmallWidth = parseInt($logo.attr('data-sticky-width') ? $logo.attr('data-sticky-width') : 'auto'), 3695 logoSmallHeight = parseInt($logo.attr('data-sticky-height') ? $logo.attr('data-sticky-height') : 'auto'); 3696 3697 if (self.options.stickyChangeLogoWrapper) { 3698 $logoWrapper.css({ 3699 'width': $logo.outerWidth(true), 3700 'height': $logo.outerHeight(true) 3701 }); 3702 } 3703 3704 self.changeLogo = function(activate) { 3705 if(activate) { 3706 3707 $logo.css({ 3708 'top': logoSmallTop, 3709 'width': logoSmallWidth, 3710 'height': logoSmallHeight 3711 }); 3712 3713 } else { 3714 3715 $logo.css({ 3716 'top': 0, 3717 'width': logoWidth, 3718 'height': logoHeight 3719 }); 3720 3721 } 3722 } 3723 3724 $.event.trigger({ 3725 type: 'stickyChangeLogo.loaded' 3726 }); 3727 3728 } 3729 3730 // Side Header 3731 var headerBodyHeight, 3732 flag = false; 3733 3734 self.checkSideHeader = function() { 3735 if($window.width() < 992 && flag == false) { 3736 headerBodyHeight = self.options.headerBody.height(); 3737 flag = true; 3738 } 3739 3740 if(self.options.stickyStartAt == 0 && sideHeader) { 3741 self.options.wrapper.css('min-height', 0); 3742 } 3743 3744 if(self.options.stickyStartAt > 0 && sideHeader && $window.width() < 992) { 3745 self.options.wrapper.css('min-height', headerBodyHeight); 3746 } 3747 } 3748 3749 return this; 3750 }, 3751 3752 events: function() { 3753 var self = this; 3754 3755 if (!this.options.stickyEnableOnBoxed && $('body').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') || !this.options.stickyEnabled) { 3756 return this; 3757 } 3758 3759 if (!self.options.alwaysStickyEnabled) { 3760 $(window).on('scroll resize', function() { 3761 self.checkStickyHeader(); 3762 }); 3763 } else { 3764 self.activateStickyHeader(); 3765 } 3766 3767 $(window).on('load resize', function(){ 3768 self.checkSideHeader(); 3769
3769 }); 3770 3771 return this; 3772 } 3773 3774 } 3775 3776 }); 3777 3778}).apply(this, [window.theme, jQuery]); 3779 3780 3781
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.