1/* 2Name: Theme Base 3Written by: Okler Themes - (http://www.okler.net) 4Theme Version: 7.6.0 5*/ 6 7// Theme 8window.theme = {}; 9 10// Theme Common Functions 11window.theme.fn = { 12 13 getOptions: function(opts) { 14 15 if (typeof(opts) == 'object') { 16 17 return opts; 18 19 } else if (typeof(opts) == 'string') { 20 21 try { 22 return JSON.parse(opts.replace(/'/g,'"').replace(';','')); 23 } catch(e) { 24 return {}; 25 } 26 27 } else { 28 29 return {}; 30 31 } 32 33 } 34 35}; 36 37// Animate 38(function(theme, $) { 39 40 theme = theme || {}; 41 42 var instanceName = '__animate'; 43 44 var PluginAnimate = function($el, opts) { 45 return this.initialize($el, opts); 46 }; 47 48 PluginAnimate.defaults = { 49 accX: 0, 50 accY: -80, 51 delay: 100, 52 duration: '750ms', 53 minWindowWidth: 767 54 }; 55 56 PluginAnimate.prototype = { 57 initialize: function($el, opts) { 58 if ($el.data(instanceName)) { 59 return this; 60 } 61 62 this.$el = $el; 63 64 this 65 .setData() 66 .setOptions(opts) 67 .build(); 68 69 return this; 70 }, 71 72 setData: function() { 73 this.$el.data(instanceName, this); 74 75 return this; 76 }, 77 78 setOptions: function(opts) { 79 this.options = $.extend(true, {}, PluginAnimate.defaults, opts, { 80 wrapper: this.$el 81 }); 82 83 return this; 84 }, 85 86 build: function() { 87 var self = this; 88 89 if($('body').hasClass('loading-overlay-showing')) { 90 $(window).on('loading.overlay.ready', function(){ 91 self.animate(); 92 }); 93 } else { 94 self.animate(); 95 } 96 97 return this; 98 }, 99 100 animate: function() { 101 var self = this, 102 $el = this.options.wrapper, 103 delay = 0, 104 duration = this.options.duration, 105 elTopDistance = $el.offset().top, 106 windowTopDistance = $(window).scrollTop(); 107 108 $el.addClass('appear-animation animated'); 109 110 if (!$('html').hasClass('no-csstransitions') && $(window).width() > self.options.minWindowWidth && elTopDistance >= windowTopDistance) { 111 112 $el.appear(function() { 113 114 $el.one('animation:show', function(ev) { 115 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 116 duration = ($el.attr('data-appear-animation-duration') ? $el.attr('data-appear-animation-duration') : self.options.duration); 117 118 if (duration != '750ms') { 119 $el.css('animation-duration', duration); 120 } 121 122 $el.css('animation-delay', delay + 'ms'); 123 124 $el.addClass($el.attr('data-appear-animation') + ' appear-animation-visible'); 125 }); 126 127 $el.trigger('animation:show'); 128 129 }, { 130 accX: self.options.accX, 131 accY: self.options.accY 132 }); 133 134 } else { 135 136 $el.addClass('appear-animation-visible'); 137 138 } 139 140 return this; 141 } 142 }; 143 144 // expose to scope 145 $.extend(theme, { 146 PluginAnimate: PluginAnimate 147 }); 148 149 // jquery plugin 150 $.fn.themePluginAnimate = function(opts) { 151 return this.map(function() { 152 var $this = $(this); 153 154 if ($this.data(instanceName)) { 155 return $this.data(instanceName); 156 } else { 157 return new PluginAnimate($this, opts); 158 } 159 160 }); 161 }; 162 163}).apply(this, [window.theme, jQuery]); 164 165// Before / After 166(function(theme, $) { 167 168 theme = theme || {}; 169 170 var instanceName = '__beforeafter'; 171 172 var PluginBeforeAfter = function($el, opts) { 173 return this.initialize($el, opts); 174 }; 175 176 PluginBeforeAfter.defaults = { 177 178 }; 179 180 PluginBeforeAfter.prototype = { 181 initialize: function($el, opts) { 182 this.$el = $el; 183 184 this 185 .setData() 186 .setOptions(opts) 187 .build(); 188 189 return this; 190 }, 191 192 setData: function() { 193 this.$el.data(instanceName, this); 194 195 return this; 196 }, 197 198 setOptions: function(opts) { 199 this.options = $.extend(true, {}, PluginBeforeAfter.defaults, opts, { 200 wrapper: this.$el 201 }); 202 203 return this; 204 }, 205 206 build: function() { 207 208 if (!($.isFunction($.fn.twentytwenty))) { 209 return this; 210 } 211 212 var self = this; 213 214 self.options.wrapper 215 .twentytwenty(self.options); 216 217 return this; 218 219 } 220 }; 221 222 // expose to scope 223 $.extend(theme, { 224 PluginBeforeAfter: PluginBeforeAfter 225 }); 226 227 // jquery plugin 228 $.fn.themePluginBeforeAfter = function(opts) { 229 return this.map(function() { 230 var $this = $(this); 231 232 if ($this.data(instanceName)) { 233 return $this.data(instanceName); 234 } else { 235 return new PluginBeforeAfter($this, opts); 236 } 237 238 }); 239 } 240 241}).apply(this, [window.theme, jQuery]); 242 243// Carousel
244(function(theme, $) { 245 246 theme = theme || {}; 247 248 var instanceName = '__carousel'; 249 250 var PluginCarousel = function($el, opts) { 251 return this.initialize($el, opts); 252 }; 253 254 PluginCarousel.defaults = { 255 loop: true, 256 responsive: { 257 0: { 258 items: 1 259 }, 260 479: { 261 items: 1 262 }, 263 768: { 264 items: 2 265 }, 266 979: { 267 items: 3 268 }, 269 1199: { 270 items: 4 271 } 272 }, 273 navText: [] 274 }; 275 276 PluginCarousel.prototype = { 277 initialize: function($el, opts) { 278 if ($el.data(instanceName)) { 279 return this; 280 } 281 282 this.$el = $el; 283 284 this 285 .setData() 286 .setOptions(opts) 287 .build(); 288 289 return this; 290 }, 291 292 setData: function() { 293 this.$el.data(instanceName, this); 294 295 return this; 296 }, 297 298 setOptions: function(opts) { 299 this.options = $.extend(true, {}, PluginCarousel.defaults, opts, { 300 wrapper: this.$el 301 }); 302 303 return this; 304 }, 305 306 build: function() { 307 if (!($.isFunction($.fn.owlCarousel))) { 308 return this; 309 } 310 311 var self = this, 312 $el = this.options.wrapper; 313 314 // Add Theme Class 315 $el.addClass('owl-theme'); 316 317 // Add Loading 318 $el.addClass('owl-loading'); 319 320 // Force RTL according to HTML dir attribute 321 if ($('html').attr('dir') == 'rtl') { 322 this.options = $.extend(true, {}, this.options, { 323 rtl: true 324 }); 325 } 326 327 if (this.options.items == 1) { 328 this.options.responsive = {} 329 } 330 331 if (this.options.items > 4) { 332 this.options = $.extend(true, {}, this.options, { 333 responsive: { 334 1199: { 335 items: this.options.items 336 } 337 } 338 }); 339 } 340 341 // Auto Height Fixes 342 if (this.options.autoHeight) { 343 var itemsHeight = []; 344 345 $el.find('.owl-item').each(function(){ 346 if( $(this).hasClass('active') ) { 347 itemsHeight.push( $(this).height() ); 348 } 349 }); 350 351 $(window).afterResize(function() { 352 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 353 }); 354 355 $(window).on('load', function() { 356 $el.find('.owl-stage-outer').height( Math.max.apply(null, itemsHeight) ); 357 }); 358 } 359 360 // Initialize OwlCarousel 361 $el.owlCarousel(this.options).addClass('owl-carousel-init'); 362 363 // Sync 364 if ($el.attr('data-sync')) { 365 $el.on('change.owl.carousel', function(event) { 366 if (event.namespace && event.property.name === 'position') { 367 var target = event.relatedTarget.relative(event.property.value, true); 368 $( $el.data('sync') ).owlCarousel('to', target, 300, true); 369 } 370 }); 371 } 372 373 // Carousel Center Active Item 374 if( $el.hasClass('carousel-center-active-item') ) { 375 var itemsActive = $el.find('.owl-item.active'), 376 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ),
377 itemCenter = itemsActive.eq(indexCenter); 378 379 itemCenter.addClass('current'); 380 381 $el.on('change.owl.carousel', function(event) { 382 $el.find('.owl-item').removeClass('current'); 383 384 setTimeout(function(){ 385 var itemsActive = $el.find('.owl-item.active'), 386 indexCenter = Math.floor( ($el.find('.owl-item.active').length - 1) / 2 ), 387 itemCenter = itemsActive.eq(indexCenter); 388 389 itemCenter.addClass('current'); 390 }, 100); 391 }); 392 393 // Refresh 394 $el.trigger('refresh.owl.carousel'); 395 396 } 397 398 // Remove Loading 399 $el.removeClass('owl-loading'); 400 401 // Remove Height 402 $el.css('height', 'auto'); 403 404 return this; 405 } 406 }; 407 408 // expose to scope 409 $.extend(theme, { 410 PluginCarousel: PluginCarousel 411 }); 412 413 // jquery plugin 414 $.fn.themePluginCarousel = function(opts) { 415 return this.map(function() { 416 var $this = $(this); 417 418 if ($this.data(instanceName)) { 419 return $this.data(instanceName); 420 } else { 421 return new PluginCarousel($this, opts); 422 } 423 424 }); 425 } 426 427}).apply(this, [window.theme, jQuery]); 428 429// Chart Circular 430(function(theme, $) { 431 432 theme = theme || {}; 433 434 var instanceName = '__chartCircular'; 435 436 var PluginChartCircular = function($el, opts) { 437 return this.initialize($el, opts); 438 }; 439 440 PluginChartCircular.defaults = { 441 accX: 0, 442 accY: -150, 443 delay: 1, 444 barColor: '#0088CC', 445 trackColor: '#f2f2f2', 446 scaleColor: false, 447 scaleLength: 5, 448 lineCap: 'round', 449 lineWidth: 13, 450 size: 175, 451 rotate: 0, 452 animate: ({ 453 duration: 2500, 454 enabled: true 455 }) 456 }; 457 458 PluginChartCircular.prototype = { 459 initialize: function($el, opts) { 460 if ($el.data(instanceName)) { 461 return this; 462 } 463 464 this.$el = $el; 465 466 this 467 .setData() 468 .setOptions(opts) 469 .build(); 470 471 return this; 472 }, 473 474 setData: function() { 475 this.$el.data(instanceName, this); 476 477 return this; 478 }, 479 480 setOptions: function(opts) { 481 this.options = $.extend(true, {}, PluginChartCircular.defaults, opts, { 482 wrapper: this.$el 483 }); 484 485 return this; 486 }, 487 488 build: function() { 489 if (!($.isFunction($.fn.appear)) || !($.isFunction($.fn.easyPieChart))) { 490 return this; 491 } 492 493 var self = this, 494 $el = this.options.wrapper, 495 value = ($el.attr('data-percent') ? $el.attr('data-percent') : 0), 496 percentEl = $el.find('.percent'); 497 498 $.extend(true, self.options, { 499 onStep: function(from, to, currentValue) { 500 percentEl.html(parseInt(currentValue)); 501 } 502 }); 503 504 $el.attr('data-percent', 0); 505 506 $el.appear(function() { 507 508 $el.easyPieChart(self.options); 509 510 setTimeout(function() { 511 512 $el.data('easyPieChart').update(value); 513 $el.attr('data-percent', value); 514 515 }, self.options.delay); 516 517 }, { 518 accX: self.options.accX, 519 accY: self.options.accY 520 }); 521 522 return this; 523 } 524 }; 525 526 // expose to scope 527 $.extend(theme, { 528 PluginChartCircular: PluginChartCircular 529 }); 530 531 // jquery plugin 532 $.fn.themePluginChartCircular = function(opts) { 533 return this.map(function() { 534 var $this = $(this); 535 536 if ($this.data(instanceName)) { 537 return $this.data(instanceName); 538 } else { 539 return new PluginChartCircular($this, opts); 540 } 541 542 }); 543 } 544 545}).apply(this, [window.theme, jQuery]); 546 547// Countdown 548(function(theme, $) { 549 550 theme = theme || {}; 551 552 var instanceName = '__countdown'; 553 554 var PluginCountdown = function($el, opts) { 555 return this.initialize($el, opts); 556 }; 557 558 PluginCountdown.defaults = { 559 date: '2030/06/10 12:00:00', 560 textDay: 'DAY', 561 textHour: 'HRS', 562 textMin: 'MIN', 563 textSec: 'SEC', 564 uppercase: true, 565 numberClass: '', 566 wrapperClass: '', 567 insertHTMLbefore: '', 568 insertHTMLafter: '' 569 }; 570 571 PluginCountdown.prototype = { 572 initialize: function($el, opts) { 573 if ($el.data(instanceName)) { 574 return this; 575 } 576 577 this.$el = $el; 578 579 this 580 .setData() 581 .setOptions(opts) 582 .build(); 583 584 return this; 585 }, 586 587 setData: function() { 588 this.$el.data(instanceName, this); 589 590 return this; 591 }, 592 593 setOptions: function(opts) { 594 this.options = $.extend(true, {}, PluginCountdown.defaults, opts, { 595 wrapper: this.$el 596 }); 597 598 return this; 599 }, 600 601 build: function() { 602 if (!($.isFunction($.fn.countTo))) { 603 return this; 604 } 605 606 var self = this, 607 $el = this.options.wrapper, 608 numberClass = ( self.options.numberClass ) ? ' ' + self.options.numberClass : '', 609 wrapperClass = ( self.options.wrapperClass ) ? ' ' + self.options.wrapperClass : ''; 610 611 if( self.options.uppercase ) { 612 $el.countdown(self.options.date).on('update.countdown', function(event) { 613 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore 614 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'<div class="d-inline text-uppercase">%!d</div></span> ' 615 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> ' 616 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> ' 617 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> ' 618 + self.options.insertHTMLafter 619 )); 620 }); 621 } else { 622 $el.countdown(self.options.date).on('update.countdown', function(event) { 623 var $this = $(this).html(event.strftime(self.options.insertHTMLbefore 624 + '<span class="days'+ wrapperClass +'"><span class="'+ numberClass +'">%D</span> '+ self.options.textDay +'%!d</span> ' 625 + '<span class="hours'+ wrapperClass +'"><span class="'+ numberClass +'">%H</span> '+ self.options.textHour +'</span> ' 626 + '<span class="minutes'+ wrapperClass +'"><span class="'+ numberClass +'">%M</span> '+ self.options.textMin +'</span> ' 627 + '<span class="seconds'+ wrapperClass +'"><span class="'+ numberClass +'">%S</span> '+ self.options.textSec +'</span> ' 628 + self.options.insertHTMLafter 629 )); 630 }); 631 } 632 633 return this; 634 } 635 }; 636 637 // expose to scope 638 $.extend(theme, { 639 PluginCountdown: PluginCountdown 640 }); 641 642 // jquery plugin 643 $.fn.themePluginCountdown = function(opts) { 644 return this.map(function() { 645 var $this = $(this); 646 647 if ($this.data(instanceName)) { 648 return $this.data(instanceName); 649 } else { 650 return new PluginCountdown($this, opts); 651 } 652 653 }); 654 } 655 656}).apply(this, [window.theme, jQuery]); 657 658// Counter 659(function(theme, $) { 660 661 theme = theme || {}; 662 663 var instanceName = '__counter'; 664 665 var PluginCounter = function($el, opts) { 666 return this.initialize($el, opts); 667 }; 668 669 PluginCounter.defaults = { 670 accX: 0, 671 accY: 0, 672 speed: 3000, 673 refreshInterval: 100, 674 decimals: 0, 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// Float Element 764(function(theme, $) { 765 766 'use strict'; 767 768 theme = theme || {}; 769 770 var instanceName = '__floatElement'; 771 772 var PluginFloatElement = function($el, opts) { 773 return this.initialize($el, opts); 774 }; 775 776 PluginFloatElement.defaults = { 777 startPos: 'top', 778 speed: 3, 779 horizontal: false, 780 transition: false 781 }; 782 783 PluginFloatElement.prototype = { 784 initialize: function($el, opts) { 785 if ($el.data(instanceName)) { 786 return this; 787 } 788 789 this.$el = $el; 790 791 this 792 .setData() 793 .setOptions(opts) 794 .build(); 795 796 return this; 797 }, 798 799 setData: function() { 800 this.$el.data(instanceName, this); 801 802 return this; 803 }, 804 805 setOptions: function(opts) { 806 this.options = $.extend(true, {}, PluginFloatElement.defaults, opts, { 807 wrapper: this.$el 808 }); 809 810 return this; 811 }, 812 813 build: function() { 814 var self = this, 815 $el = this.options.wrapper, 816 $window = $(window), 817 minus; 818 819 if( self.options.style ) { 820 $el.attr('style', self.options.style); 821 } 822 823 if( $window.width() > 767 ) { 824 825 // Set Start Position 826 if( self.options.startPos == 'none' ) { 827 minus = ''; 828 } else if( self.options.startPos == 'top' ) { 829 $el.css({ 830 top: 0 831 }); 832 minus = ''; 833 } else { 834 $el.css({ 835 bottom: 0 836 }); 837 minus = '-'; 838 } 839 840 // Set Transition 841 if( self.options.transition ) { 842 $el.css({ 843 transition: 'ease transform 500ms' 844 }); 845 } 846 847 // First Load 848 self.movement(minus); 849 850 // Scroll 851 $window.on('scroll', function(){ 852 self.movement(minus); 853 }); 854 855 } 856 857 return this; 858 }, 859 860 movement: function(minus) { 861 var self = this, 862 $el = this.options.wrapper, 863 $window = $(window), 864 scrollTop = $window.scrollTop(), 865 elementOffset = $el.offset().top, 866 currentElementOffset = (elementOffset - scrollTop); 867 868 var scrollPercent = 100 * currentElementOffset / ($window.height()); 869 870 if( $el.visible( true ) ) { 871 872 if( !self.options.horizontal ) { 873 874 $el.css({ 875 transform: 'translate3d(0, '+ minus + scrollPercent / self.options.speed +'%, 0)' 876 }); 877 878 } else { 879 880 $el.css({ 881 transform: 'translate3d('+ minus + scrollPercent / self.options.speed +'%, '+ minus + scrollPercent / self.options.speed +'%, 0)' 882 }); 883 884 } 885 886 } 887 } 888 }; 889 890 // expose to scope 891 $.extend(theme, { 892 PluginFloatElement: PluginFloatElement 893 }); 894 895 // jquery plugin 896 $.fn.themePluginFloatElement = function(opts) { 897 return this.map(function() { 898 var $this = $(this); 899 900 if ($this.data(instanceName)) { 901 return $this.data(instanceName); 902 } else { 903 return new PluginFloatElement($this, opts); 904 } 905 906 }); 907 } 908 909}).apply(this, [window.theme, jQuery]); 910 911// Icon 912(function(theme, $) { 913 914 'use strict'; 915 916 theme = theme || {}; 917 918 var instanceName = '__icon'; 919 920 var PluginIcon = function($el, opts) { 921 return this.initialize($el, opts); 922 }; 923 924 PluginIcon.defaults = { 925 color: '#2388ED', 926 animated: false, 927 delay: 300 928 }; 929 930 PluginIcon.prototype = { 931 initialize: function($el, opts) { 932 if ($el.data(instanceName)) { 933 return this; 934 } 935 936 this.$el = $el; 937 938 this 939 .setData() 940 .setOptions(opts) 941 .build(); 942 943 return this; 944 }, 945 946 setData: function() { 947 this.$el.data(instanceName, this); 948 949 return this; 950 }, 951 952 setOptions: function(opts) { 953 this.options = $.extend(true, {}, PluginIcon.defaults, opts, { 954 wrapper: this.$el 955 }); 956 957 return this; 958 }, 959 960 build: function() { 961 var self = this, 962 $el = this.options.wrapper, 963 color = self.options.color, 964 elTopDistance = $el.offset().top, 965 windowTopDistance = $(window).scrollTop(), 966 duration = ( self.options.animated && !self.options.strokeBased ) ? 200 : 100; 967 968 // Check origin 969 if( window.location.origin === 'file://' ) { 970 $el.css('opacity', 1); 971 return; 972 } 973 974 // Duration 975 if( self.options.duration ) { 976 duration = self.options.duration; 977 } 978 979 // SVG Content 980 var SVGContent = $.get({ 981 url: $el.attr('src'), 982 success: function(data, status, xhr){
983 var iconWrapper = $('<div class="animated-icon">'+ xhr.responseText +'</div>'), 984 uniqid = 'icon_' + Math.floor(Math.random() * 26) + Date.now(); 985 986 iconWrapper.find('svg').attr('id', uniqid); 987 988 if( $el.attr('width') ) { 989 iconWrapper.find('svg') 990 .attr('width', $el.attr('width')) 991 .attr('height', $el.attr('width')); 992 } 993 994 $el.replaceWith(iconWrapper); 995 996 $el = iconWrapper; 997 998 var icon = new Vivus(uniqid, {start: 'manual', type: 'sync', selfDestroy: true, duration: duration, onReady: function(obj){ 999 var styleElement = document.createElementNS("http://www.w3.org/2000/svg", "style"), 1000 animateStyle = ''; 1001 1002 // SVG Fill Based 1003 if( self.options.animated && !self.options.strokeBased || !self.options.animated && color && !self.options.strokeBased ) { 1004 animateStyle = 'stroke-width: 0.1px; fill-opacity: 0; transition: ease fill-opacity 300ms;'; 1005 1006 // Set Style on SVG inside object 1007 styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { fill: '+ color +'; stroke: '+ color +'; '+ animateStyle + (self.options.svgStyle ? self.options.svgStyle : "") + ' } .finished path { fill-opacity: 1; }'; 1008 obj.el.appendChild(styleElement); 1009 } 1010 1011 // SVG Stroke Based 1012 if( self.options.animated && self.options.strokeBased || !self.options.animated && color && self.options.strokeBased ) { 1013 1014 // Set Style on SVG inside object 1015 styleElement.textContent = '#' + uniqid + ' path, #' + uniqid + ' line, #' + uniqid + ' rect, #' + uniqid + ' circle, #' + uniqid + ' polyline { stroke: '+ color +'; ' + (self.options.svgStyle ? self.options.svgStyle : "") + '}'; 1016 obj.el.appendChild(styleElement); 1017 } 1018 1019 $.event.trigger('theme.plugin.icon.svg.ready'); 1020 }}); 1021 1022 // Isn't animated 1023 if( !self.options.animated ) { 1024 setTimeout(function(){ 1025 icon.finish(); 1026 }, 10); 1027 $el.css({ opacity: 1 }); 1028 } 1029 1030 // Animated 1031 if( self.options.animated && $(window).width() > 767 ) { 1032 // First Load 1033 if( $el.visible( true ) ) { 1034 self.startIconAnimation( icon, $el ); 1035 } else if( elTopDistance < windowTopDistance ) { 1036 self.startIconAnimation( icon, $el ); 1037 } 1038 1039 // On Scroll 1040 $(window).on('scroll', function(){ 1041 if( $el.visible( true ) ) { 1042 self.startIconAnimation( icon, $el ); 1043 } 1044 }); 1045 1046 } else { 1047 1048 $el.css({ opacity: 1 }); 1049 icon.finish(); 1050 1051 $(window).on('theme.plugin.icon.svg.ready', function(){ 1052 setTimeout(function(){ 1053 icon.el.setAttribute('class', 'finished'); 1054 icon.finish(); 1055 }, 300); 1056 }); 1057 1058 } 1059 1060 } 1061 }); 1062 1063 return this; 1064 }, 1065 startIconAnimation: function(icon, $el) { 1066 var self = this; 1067 1068 // Animate for better performance 1069 $({to:0}).animate({to:1}, ((self.options.strokeBased) ? self.options.delay : self.options.delay + 300 ), function() { 1070 $el.css({ opacity: 1 }); 1071 }); 1072 1073 $({to:0}).animate({to:1}, self.options.delay, function() { 1074 icon.play(1); 1075 1076 setTimeout(function(){ 1077 icon.el.setAttribute('class', 'finished'); 1078 }, icon.duration * 5 ); 1079 }); 1080 } 1081 }; 1082 1083 // expose to scope 1084 $.extend(theme, { 1085 PluginIcon: PluginIcon 1086 }); 1087 1088 // jquery plugin 1089 $.fn.themePluginIcon = function(opts) { 1090 return this.map(function() { 1091 var $this = $(this); 1092 1093 if ($this.data(instanceName)) { 1094 return $this.data(instanceName); 1095 } else { 1096 return new PluginIcon($this, opts); 1097 } 1098 1099 }); 1100 }; 1101 1102}).apply(this, [window.theme, jQuery]); 1103 1104// Lazy Load 1105(function(theme, $) { 1106 1107 theme = theme || {}; 1108 1109 var instanceName = '__lazyload'; 1110 1111 var PluginLazyLoad = function($el, opts) { 1112 return this.initialize($el, opts); 1113 }; 1114 1115 PluginLazyLoad.defaults = { 1116 effect: 'show', 1117 appearEffect: '', 1118 imgFluid: true, 1119 appear: function(elements_left, settings) { 1120 1121 }, 1122 load: function(elements_left, settings) { 1123 $(this).addClass($.trim('lazy-load-loaded ' + settings.appearEffect)).css({ 1124 'animation-duration': '1s' 1125 }); 1126 } 1127 }; 1128 1129 PluginLazyLoad.prototype = { 1130 initialize: function($el, opts) { 1131 if ($el.data(instanceName)) { 1132 return this; 1133 } 1134 1135 this.$el = $el; 1136 1137 this 1138 .setData() 1139 .setOptions(opts) 1140 .build() 1141 .events(); 1142 1143 return this; 1144 }, 1145 1146 setData: function() { 1147 this.$el.data(instanceName, this); 1148 1149 return this; 1150 }, 1151 1152 setOptions: function(opts) { 1153 this.options = $.extend(true, {}, PluginLazyLoad.defaults, opts, { 1154 wrapper: this.$el 1155 }); 1156 1157 return this; 1158 }, 1159 1160 build: function() { 1161 if (!($.isFunction($.fn.lazyload))) { 1162 return this; 1163 } 1164 1165 var self = this; 1166 1167 self.options.wrapper.lazyload(this.options); 1168 1169 return this; 1170 }, 1171 1172 events: function() { 1173 var self = this; 1174 1175 if( self.options.imgFluid && self.options.wrapper.is('img') ) { 1176 self.options.wrapper.on('appear', function(){ 1177 setTimeout(function(){ 1178 self.options.wrapper.addClass('img-fluid'); 1179 }, 500); 1180 }); 1181 } 1182 1183 return this; 1184 } 1185 }; 1186 1187 // expose to scope 1188 $.extend(theme, { 1189 PluginLazyLoad: PluginLazyLoad 1190 }); 1191 1192 // jquery plugin 1193 $.fn.themePluginLazyLoad = function(opts) { 1194 return this.map(function() { 1195 var $this = $(this); 1196 1197 if ($this.data(instanceName)) { 1198 return $this.data(instanceName); 1199 } else { 1200 return new PluginLazyLoad($this, opts); 1201 } 1202 1203 }); 1204 } 1205 1206}).apply(this, [window.theme, jQuery]); 1207 1208// Lightbox 1209(function(theme, $) { 1210 1211 theme = theme || {}; 1212 1213 var instanceName = '__lightbox'; 1214 1215 var PluginLightbox = function($el, opts) { 1216 return this.initialize($el, opts); 1217 }; 1218 1219 PluginLightbox.defaults = { 1220 tClose: 'Close (Esc)', // Alt text on close button 1221 tLoading: 'Loading...', // Text that is displayed during loading. Can contain %curr% and %total% keys 1222 gallery: { 1223 tPrev: 'Previous (Left arrow key)', // Alt text on left arrow 1224 tNext: 'Next (Right arrow key)', // Alt text on right arrow 1225 tCounter: '%curr% of %total%' // Markup for "1 of 7" counter 1226 }, 1227 image: { 1228 tError: '<a href="%url%">The image</a> could not be loaded.' // Error message when image could not be loaded 1229 }, 1230 ajax: { 1231 tError: '<a href="%url%">The content</a> could not be loaded.' // Error message when ajax request failed 1232 }, 1233 callbacks: { 1234 open: function() { 1235 $('html').addClass('lightbox-opened'); 1236 }, 1237 close: function() { 1238 $('html').removeClass('lightbox-opened'); 1239 } 1240 } 1241 }; 1242 1243 PluginLightbox.prototype = { 1244 initialize: function($el, opts) { 1245 if ($el.data(instanceName)) { 1246 return this; 1247 } 1248 1249 this.$el = $el; 1250 1251 this 1252 .setData() 1253 .setOptions(opts) 1254 .build(); 1255 1256 return this; 1257 }, 1258 1259 setData: function() { 1260 this.$el.data(instanceName, this); 1261 1262 return this; 1263 }, 1264 1265 setOptions: function(opts) { 1266 this.options = $.extend(true, {}, PluginLightbox.defaults, opts, { 1267 wrapper: this.$el 1268 }); 1269 1270 return this; 1271 }, 1272 1273 build: function() { 1274 if (!($.isFunction($.fn.magnificPopup))) { 1275 return this; 1276 } 1277 1278 this.options.wrapper.magnificPopup(this.options); 1279 1280 return this; 1281 } 1282 }; 1283 1284 // expose to scope 1285 $.extend(theme, { 1286 PluginLightbox: PluginLightbox 1287 }); 1288 1289 // jquery plugin 1290 $.fn.themePluginLightbox = function(opts) { 1291 return this.map(function() { 1292 var $this = $(this); 1293 1294 if ($this.data(instanceName)) { 1295 return $this.data(instanceName); 1296 } else { 1297 return new PluginLightbox($this, opts); 1298 } 1299 1300 }); 1301 } 1302 1303}).apply(this, [window.theme, jQuery]); 1304 1305// Loading Overlay 1306(function(theme, $) { 1307 1308 'use strict'; 1309 1310 theme = theme || {}; 1311 1312 var loadingOverlayTemplate = [ 1313 '<div class="loading-overlay">', 1314 '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>', 1315 '</div>' 1316 ].join(''); 1317 1318 var LoadingOverlay = function( $wrapper, options ) { 1319 return this.initialize( $wrapper, options ); 1320 }; 1321 1322 LoadingOverlay.prototype = { 1323 1324 options: { 1325 css: {}, 1326 hideDelay: 500 1327 }, 1328 1329 initialize: function( $wrapper, options ) { 1330 this.$wrapper = $wrapper; 1331 1332 this 1333 .setVars() 1334 .setOptions( options ) 1335 .build() 1336 .events(); 1337 1338 this.$wrapper.data( 'loadingOverlay', this ); 1339 }, 1340 1341 setVars: function() {
1342 this.$overlay = this.$wrapper.find('.loading-overlay'); 1343 1344 return this; 1345 }, 1346 1347 setOptions: function( options ) { 1348 if ( !this.$overlay.get(0) ) { 1349 this.matchProperties(); 1350 } 1351 this.options = $.extend( true, {}, this.options, options, theme.fn.getOptions(this.$wrapper.data('plugin-options')) ); 1352 1353 this.loaderClass = this.getLoaderClass( this.options.css.backgroundColor ); 1354 1355 return this; 1356 }, 1357 1358 build: function() { 1359 if ( !this.$overlay.closest(document.documentElement).get(0) ) { 1360 if ( !this.$cachedOverlay ) { 1361 this.$overlay = $( loadingOverlayTemplate ).clone(); 1362 1363 if ( this.options.css ) { 1364 this.$overlay.css( this.options.css ); 1365 this.$overlay.find( '.loader' ).addClass( this.loaderClass ); 1366 } 1367 } else { 1368 this.$overlay = this.$cachedOverlay.clone(); 1369 } 1370 1371 this.$wrapper.append( this.$overlay ); 1372 } 1373 1374 if ( !this.$cachedOverlay ) { 1375 this.$cachedOverlay = this.$overlay.clone(); 1376 } 1377 1378 return this; 1379 }, 1380 1381 events: function() { 1382 var _self = this; 1383 1384 if ( this.options.startShowing ) { 1385 _self.show(); 1386 } 1387 1388 if ( this.$wrapper.is('body') || this.options.hideOnWindowLoad ) { 1389 $( window ).on( 'load error', function() { 1390 _self.hide(); 1391 }); 1392 } 1393 1394 if ( this.options.listenOn ) { 1395 $( this.options.listenOn ) 1396 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 1397 e.stopPropagation(); 1398 _self.show(); 1399 }) 1400 .on( 'loading-overlay:hide complete.ic', function( e ) { 1401 e.stopPropagation(); 1402 _self.hide(); 1403 }); 1404 } 1405 1406 this.$wrapper 1407 .on( 'loading-overlay:show beforeSend.ic', function( e ) { 1408 if ( e.target === _self.$wrapper.get(0) ) { 1409 e.stopPropagation(); 1410 _self.show(); 1411 return true; 1412 } 1413 return false; 1414 }) 1415 .on( 'loading-overlay:hide complete.ic', function( e ) { 1416 if ( e.target === _self.$wrapper.get(0) ) { 1417 e.stopPropagation(); 1418 _self.hide(); 1419 return true; 1420 } 1421 return false; 1422 }); 1423 1424 return this; 1425 }, 1426 1427 show: function() { 1428 this.build(); 1429 1430 this.position = this.$wrapper.css( 'position' ).toLowerCase(); 1431 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 1432 this.$wrapper.css({ 1433 position: 'relative' 1434 }); 1435 } 1436 this.$wrapper.addClass( 'loading-overlay-showing' ); 1437 }, 1438 1439 hide: function() { 1440 var _self = this; 1441 1442 setTimeout(function() { 1443 _self.$wrapper.removeClass( 'loading-overlay-showing' ); 1444 1445 if ( this.position != 'relative' || this.position != 'absolute' || this.position != 'fixed' ) { 1446 _self.$wrapper.css({ position: '' }); 1447 } 1448 1449 $(window).trigger('loading.overlay.ready'); 1450 }, _self.options.hideDelay); 1451 }, 1452 1453 matchProperties: function() { 1454 var i, 1455 l, 1456 properties; 1457 1458 properties = [ 1459 'backgroundColor', 1460 'borderRadius' 1461 ]; 1462 1463 l = properties.length; 1464 1465 for( i = 0; i < l; i++ ) { 1466 var obj = {}; 1467 obj[ properties[ i ] ] = this.$wrapper.css( properties[ i ] ); 1468 1469 $.extend( this.options.css, obj ); 1470 } 1471 }, 1472 1473 getLoaderClass: function( backgroundColor ) { 1474 if ( !backgroundColor || backgroundColor === 'transparent' || backgroundColor === 'inherit' ) { 1475 return 'black'; 1476 } 1477 1478 var hexColor, 1479 r, 1480 g, 1481 b, 1482 yiq; 1483 1484 var colorToHex = function( color ){ 1485 var hex, 1486 rgb; 1487 1488 if( color.indexOf('#') >- 1 ){ 1489 hex = color.replace('#', ''); 1490 } else { 1491 rgb = color.match(/\d+/g); 1492 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); 1493 } 1494 1495 if ( hex.length === 3 ) { 1496 hex = hex + hex; 1497 } 1498 1499 return hex; 1500 }; 1501 1502 hexColor = colorToHex( backgroundColor ); 1503 1504 r = parseInt( hexColor.substr( 0, 2), 16 ); 1505 g = parseInt( hexColor.substr( 2, 2), 16 ); 1506 b = parseInt( hexColor.substr( 4, 2), 16 ); 1507 yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000; 1508 1509 return ( yiq >= 128 ) ? 'black' : 'white'; 1510 } 1511 1512 }; 1513 1514 // expose to scope 1515 $.extend(theme, { 1516 LoadingOverlay: LoadingOverlay 1517 }); 1518 1519 // expose as a jquery plugin 1520 $.fn.loadingOverlay = function( opts ) { 1521 return this.each(function() { 1522 var $this = $( this ); 1523 1524 var loadingOverlay = $this.data( 'loadingOverlay' ); 1525 if ( loadingOverlay ) { 1526 return loadingOverlay; 1527 } else { 1528 var options = opts || $this.data( 'loading-overlay-options' ) || {}; 1529 return new LoadingOverlay( $this, options ); 1530 } 1531 }); 1532 } 1533 1534 // auto init 1535 $('[data-loading-overlay]').loadingOverlay(); 1536 1537}).apply(this, [window.theme, jQuery]); 1538 1539// Masonry 1540(function(theme, $) { 1541 1542 theme = theme || {}; 1543 1544 var instanceName = '__masonry'; 1545 1546 var PluginMasonry = function($el, opts) { 1547 return this.initialize($el, opts); 1548 }; 1549 1550 PluginMasonry.defaults = { 1551 1552 }; 1553 1554 PluginMasonry.prototype = { 1555 initialize: function($el, opts) { 1556 if ($el.data(instanceName)) { 1557 return this; 1558 } 1559 1560 this.$el = $el; 1561 1562 this 1563 .setData() 1564 .setOptions(opts) 1565 .build(); 1566 1567 return this; 1568 }, 1569 1570 setData: function() { 1571 this.$el.data(instanceName, this); 1572 1573 return this; 1574 }, 1575 1576 setOptions: function(opts) { 1577 this.options = $.extend(true, {}, PluginMasonry.defaults, opts, { 1578 wrapper: this.$el 1579 }); 1580 1581 return this; 1582 }, 1583 1584 build: function() { 1585 if (!($.isFunction($.fn.isotope))) { 1586 return this; 1587 } 1588 1589 var self = this, 1590 $window = $(window); 1591 1592 self.$loader = false;
1593 1594 if (self.options.wrapper.parents('.masonry-loader').get(0)) { 1595 self.$loader = self.options.wrapper.parents('.masonry-loader'); 1596 self.createLoader(); 1597 } 1598 1599 self.options.wrapper.one('layoutComplete', function(event, laidOutItems) { 1600 self.removeLoader(); 1601 }); 1602 1603 self.options.wrapper.waitForImages(function() { 1604 self.options.wrapper.isotope(self.options); 1605 }); 1606 1607 // IE10/11 fix 1608 if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) { 1609 var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') ); 1610 } 1611 1612 $(window).on('resize', function() { 1613 setTimeout(function() { 1614 self.options.wrapper.isotope('layout'); 1615 }, 300); 1616 }); 1617 1618 setTimeout(function() { 1619 self.removeLoader(); 1620 }, 3000); 1621 1622 return this; 1623 }, 1624 1625 createLoader: function() { 1626 var self = this; 1627 1628 var loaderTemplate = [ 1629 '<div class="bounce-loader">', 1630 '<div class="bounce1"></div>', 1631 '<div class="bounce2"></div>', 1632 '<div class="bounce3"></div>', 1633 '</div>' 1634 ].join(''); 1635 1636 self.$loader.append(loaderTemplate); 1637 1638 return this; 1639 }, 1640 1641 removeLoader: function() { 1642 1643 var self = this; 1644 1645 if (self.$loader) { 1646 1647 self.$loader.removeClass('masonry-loader-showing'); 1648 1649 setTimeout(function() { 1650 self.$loader.addClass('masonry-loader-loaded'); 1651 }, 300); 1652 1653 } 1654 1655 } 1656 }; 1657 1658 // expose to scope 1659 $.extend(theme, { 1660 PluginMasonry: PluginMasonry 1661 }); 1662 1663 // jquery plugin 1664 $.fn.themePluginMasonry = function(opts) { 1665 return this.map(function() { 1666 var $this = $(this); 1667 1668 if ($this.data(instanceName)) { 1669 return $this.data(instanceName); 1670 } else { 1671 return new PluginMasonry($this, opts); 1672 } 1673 1674 }); 1675 } 1676 1677}).apply(this, [window.theme, jQuery]); 1678 1679// Match Height 1680(function(theme, $) { 1681 1682 theme = theme || {}; 1683 1684 var instanceName = '__matchHeight'; 1685 1686 var PluginMatchHeight = function($el, opts) { 1687 return this.initialize($el, opts); 1688 }; 1689 1690 PluginMatchHeight.defaults = { 1691 byRow: true, 1692 property: 'height', 1693 target: null, 1694 remove: false 1695 }; 1696 1697 PluginMatchHeight.prototype = { 1698 initialize: function($el, opts) { 1699 if ($el.data(instanceName)) { 1700 return this; 1701 } 1702 1703 this.$el = $el; 1704 1705 this 1706 .setData() 1707 .setOptions(opts) 1708 .build(); 1709 1710 return this; 1711 }, 1712 1713 setData: function() { 1714 this.$el.data(instanceName, this); 1715 1716 return this; 1717 }, 1718 1719 setOptions: function(opts) { 1720 this.options = $.extend(true, {}, PluginMatchHeight.defaults, opts, { 1721 wrapper: this.$el 1722 }); 1723 1724 return this; 1725 }, 1726 1727 build: function() { 1728 if (!($.isFunction($.fn.matchHeight))) { 1729 return this; 1730 } 1731 1732 var self = this; 1733 1734 self.options.wrapper.matchHeight(self.options); 1735 1736 return this; 1737 } 1738 1739 }; 1740 1741 // expose to scope 1742 $.extend(theme, { 1743 PluginMatchHeight: PluginMatchHeight 1744 }); 1745 1746 // jquery plugin 1747 $.fn.themePluginMatchHeight = function(opts) { 1748 return this.map(function() { 1749 var $this = $(this); 1750 1751 if ($this.data(instanceName)) { 1752 return $this.data(instanceName); 1753 } else { 1754 return new PluginMatchHeight($this, opts); 1755 } 1756 1757 }); 1758 } 1759 1760}).apply(this, [window.theme, jQuery]); 1761 1762// Parallax 1763(function(theme, $) { 1764 1765 theme = theme || {}; 1766 1767 var instanceName = '__parallax'; 1768 1769 var PluginParallax = function($el, opts) { 1770 return this.initialize($el, opts); 1771 }; 1772 1773 PluginParallax.defaults = { 1774 speed: 1.5, 1775 horizontalPosition: '50%', 1776 offset: 0, 1777 parallaxHeight: '180%' 1778 }; 1779 1780 PluginParallax.prototype = { 1781 initialize: function($el, opts) { 1782 if ($el.data(instanceName)) { 1783 return this; 1784 } 1785 1786 this.$el = $el; 1787 1788 this 1789 .setData() 1790 .setOptions(opts) 1791 .build(); 1792 1793 return this; 1794 }, 1795 1796 setData: function() { 1797 this.$el.data(instanceName, this); 1798 1799 return this; 1800 }, 1801 1802 setOptions: function(opts) { 1803 this.options = $.extend(true, {}, PluginParallax.defaults, opts, { 1804 wrapper: this.$el 1805 }); 1806 1807 return this; 1808 }, 1809 1810 build: function() { 1811 var self = this, 1812 $window = $(window), 1813 offset, 1814 yPos, 1815 bgpos, 1816 background; 1817 1818 // Create Parallax Element 1819 background = $('<div class="parallax-background"></div>'); 1820 1821 // Set Style for Parallax Element 1822 background.css({ 1823 'background-image' : 'url(' + self.options.wrapper.data('image-src') + ')', 1824 'background-size' : 'cover', 1825 'position' : 'absolute', 1826 'top' : 0, 1827 'left' : 0, 1828 'width' : '100%', 1829 'height' : self.options.parallaxHeight 1830 }); 1831 1832 // Add Parallax Element on DOM 1833 self.options.wrapper.prepend(background); 1834 1835 // Set Overlfow Hidden and Position Relative to Parallax Wrapper 1836 self.options.wrapper.css({ 1837 'position' : 'relative', 1838 'overflow' : 'hidden' 1839 }); 1840 1841 // Parallax Effect on Scroll & Resize 1842 var parallaxEffectOnScrolResize = function() { 1843 $window.on('scroll resize', function() { 1844 offset = self.options.wrapper.offset(); 1845 yPos = -($window.scrollTop() - (offset.top - 100)) / ((self.options.speed + 2 )); 1846 plxPos = (yPos < 0) ? Math.abs(yPos) : -Math.abs(yPos); 1847 background.css({ 1848 'transform' : 'translate3d(0, '+ ( (plxPos - 50) + (self.options.offset) ) +'px, 0)', 1849 'background-position-x' : self.options.horizontalPosition 1850 }); 1851 }); 1852 1853 $window.trigger('scroll'); 1854 } 1855 1856 if (!$.browser.mobile) { 1857 parallaxEffectOnScrolResize(); 1858 } else { 1859 if( self.options.enableOnMobile == true ) { 1860 parallaxEffectOnScrolResize(); 1861 } else { 1862 self.options.wrapper.addClass('parallax-disabled'); 1863 } 1864 } 1865 1866 return this; 1867 } 1868 }; 1869 1870 // expose to scope 1871 $.extend(theme, { 1872 PluginParallax: PluginParallax 1873 }); 1874 1875 // jquery plugin 1876 $.fn.themePluginParallax = function(opts) { 1877 return this.map(function() { 1878 var $this = $(this); 1879 1880 if ($this.data(instanceName)) { 1881 return $this.data(instanceName); 1882 } else { 1883 return new PluginParallax($this, opts); 1884 } 1885 1886 }); 1887 } 1888 1889}).apply(this, [window.theme, jQuery]); 1890 1891// Progress Bar 1892(function(theme, $) { 1893 1894 theme = theme || {}; 1895 1896 var instanceName = '__progressBar'; 1897 1898 var PluginProgressBar = function($el, opts) { 1899 return this.initialize($el, opts); 1900 }; 1901 1902 PluginProgressBar.defaults = { 1903 accX: 0, 1904 accY: -50, 1905 delay: 1 1906 }; 1907 1908 PluginProgressBar.prototype = { 1909 initialize: function($el, opts) { 1910 if ($el.data(instanceName)) { 1911 return this; 1912 } 1913 1914 this.$el = $el; 1915 1916 this 1917 .setData() 1918 .setOptions(opts) 1919 .build(); 1920 1921 return this; 1922 }, 1923 1924 setData: function() { 1925 this.$el.data(instanceName, this); 1926 1927 return this; 1928 }, 1929 1930 setOptions: function(opts) { 1931 this.options = $.extend(true, {}, PluginProgressBar.defaults, opts, { 1932 wrapper: this.$el 1933 }); 1934 1935 return this; 1936 }, 1937 1938 build: function() { 1939 if (!($.isFunction($.fn.appear))) { 1940 return this; 1941 } 1942 1943 var self = this, 1944 $el = this.options.wrapper,
1945 delay = 1; 1946 1947 $el.appear(function() { 1948 1949 delay = ($el.attr('data-appear-animation-delay') ? $el.attr('data-appear-animation-delay') : self.options.delay); 1950 1951 $el.addClass($el.attr('data-appear-animation')); 1952 1953 setTimeout(function() { 1954 1955 $el.animate({ 1956 width: $el.attr('data-appear-progress-animation') 1957 }, 1500, 'easeOutQuad', function() { 1958 $el.find('.progress-bar-tooltip').animate({ 1959 opacity: 1 1960 }, 500, 'easeOutQuad'); 1961 }); 1962 1963 }, delay); 1964 1965 }, { 1966 accX: self.options.accX, 1967 accY: self.options.accY 1968 }); 1969 1970 return this; 1971 } 1972 }; 1973 1974 // expose to scope 1975 $.extend(theme, { 1976 PluginProgressBar: PluginProgressBar 1977 }); 1978 1979 // jquery plugin 1980 $.fn.themePluginProgressBar = function(opts) { 1981 return this.map(function() { 1982 var $this = $(this); 1983 1984 if ($this.data(instanceName)) { 1985 return $this.data(instanceName); 1986 } else { 1987 return new PluginProgressBar($this, opts); 1988 } 1989 1990 }); 1991 } 1992 1993}).apply(this, [window.theme, jQuery]); 1994 1995// Revolution Slider 1996(function(theme, $) { 1997 1998 theme = theme || {}; 1999 2000 var instanceName = '__revolution'; 2001 2002 var PluginRevolutionSlider = function($el, opts) { 2003 return this.initialize($el, opts); 2004 }; 2005 2006 PluginRevolutionSlider.defaults = { 2007 sliderType: 'standard', 2008 sliderLayout: 'fullwidth', 2009 delay: 9000, 2010 gridwidth: 1170, 2011 gridheight: 500, 2012 spinner: 'spinner3', 2013 disableProgressBar: 'on', 2014 parallax: { 2015 type: 'off', 2016 bgparallax: 'off' 2017 }, 2018 navigation: { 2019 keyboardNavigation: 'off', 2020 keyboard_direction: 'horizontal', 2021 mouseScrollNavigation: 'off', 2022 onHoverStop: 'off', 2023 touch: { 2024 touchenabled: 'on', 2025 swipe_threshold: 75, 2026 swipe_min_touches: 1, 2027 swipe_direction: 'horizontal', 2028 drag_block_vertical: false 2029 }, 2030 arrows: { 2031 enable: true, 2032 hide_onmobile: false, 2033 hide_under: 0, 2034 hide_onleave: true, 2035 hide_delay: 200, 2036 hide_delay_mobile: 1200, 2037 left: { 2038 h_align: 'left', 2039 v_align: 'center', 2040 h_offset: 30, 2041 v_offset: 0 2042 }, 2043 right: { 2044 h_align: 'right', 2045 v_align: 'center', 2046 h_offset: 30, 2047 v_offset: 0 2048 } 2049 } 2050 }, 2051 2052 /* ADDONS */ 2053 addOnTypewriter: { 2054 enable: false 2055 }, 2056 addOnWhiteboard: { 2057 enable: false, 2058 2059 }, 2060 whiteboard: { 2061 movehand: { 2062 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/hand_point_right.png', 2063 width: 400, 2064 height: 1000, 2065 handtype: 'right', 2066 transform: { 2067 transformX: 50, 2068 transformY: 50 2069 }, 2070 jittering: { 2071 distance: '80', 2072 distance_horizontal: '100', 2073 repeat: '5', 2074 offset: '10', 2075 offset_horizontal: '0' 2076 }, 2077 rotation: { 2078 angle: '10', 2079 repeat: '3' 2080 } 2081 }, 2082 writehand: { 2083 src: '../vendor/rs-plugin/revolution-addons/whiteboard/assets/images/write_right_angle.png', 2084 width: 572, 2085 height: 691, 2086 handtype: 'right', 2087 transform: { 2088 transformX: 50, 2089 transformY: 50 2090 }, 2091 jittering: { 2092 distance: '80', 2093 distance_horizontal: '100', 2094 repeat: '5', 2095 offset: '10', 2096 offset_horizontal: '0' 2097 }, 2098 rotation:{ 2099 angle: '10', 2100 repeat: '3' 2101 } 2102 } 2103 }, 2104 addOnParticles: { 2105 enable: false 2106 }, 2107 particles: { 2108 startSlide: "first", 2109 endSlide: "last", 2110 zIndex: "1", 2111 particles: { 2112 number: {value: 80}, color: {value: "#ffffff"}, 2113 shape: { 2114 type: "circle", stroke: {width: 0, color: "#ffffff", opacity: 1}, 2115 image: {src: ""} 2116 }, 2117 opacity: {value: 0.5, random: true, min: 0.25, anim: {enable: false, speed: 3, opacity_min: 0, sync: false}}, 2118 size: {value: 2, random: false, min: 30, anim: {enable: false, speed: 40, size_min: 1, sync: false}}, 2119 line_linked: {enable: true, distance: 150, color: "#ffffff", opacity: 0.4, width: 1},
2120 move: {enable: true, speed: 6, direction: "none", random: true, min_speed: 6, straight: false, out_mode: "out"} 2121 }, 2122 interactivity: { 2123 events: {onhover: {enable: false, mode: "repulse"}, onclick: {enable: false, mode: "repulse"}}, 2124 modes: {grab: {distance: 400, line_linked: {opacity: 0.5}}, bubble: {distance: 400, size: 40, opacity: 0.4}, repulse: {distance: 200}} 2125 } 2126 }, 2127 addOnCountdown: { 2128 enable: false, 2129 targetdate: new Date().getTime() + 864000000, // http://www.freeformatter.com/epoch-timestamp-to-date-converter.html 2130 slidechanges: [{days: 0, hours: 0, minutes: 0, seconds: 0, slide: 2}] 2131 }, 2132 addOnSlicey: { 2133 enable: false 2134 }, 2135 addOnFilmstrip: { 2136 enable: false 2137 }, 2138 addOnBeforeAfter : { 2139 enable: false, 2140 options: { 2141 cursor: "move", 2142 carousel: false, 2143 arrowStyles: { 2144 leftIcon: "fa-icon-caret-left", 2145 rightIcon: "fa-icon-caret-right", 2146 topIcon: "fa-icon-caret-up", 2147 bottomIcon: "fa-icon-caret-down", 2148 size: "35", 2149 color: "#ffffff", 2150 spacing: "10", 2151 bgColor: "transparent", 2152 padding: "0", 2153 borderRadius: "0" 2154 }, 2155 dividerStyles: { 2156 width: "1", 2157 color: "rgba(255, 255, 255, 0.5)" 2158 } 2159 } 2160 }, 2161 addOnPanorama: { 2162 enable: false 2163 }, 2164 addOnRevealer: { 2165 enable: false, 2166 }, 2167 revealer: { 2168 direction: "open_horizontal", 2169 color: "#ffffff", 2170 duration: "1500", 2171 delay: "0", 2172 easing: "Power2.easeInOut", 2173 overlay_enabled: true, 2174 overlay_color: "#000000", 2175 overlay_duration: "1500", 2176 overlay_delay: "0", 2177 overlay_easing: "Power2.easeInOut", 2178 spinner: "1", 2179 spinnerColor: "#006dd2", 2180 spinnerHtml: "<div class='rsaddon-revealer-spinner rsaddon-revealer-spinner-1'><div class='rsaddon-revealer-1'><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><span style='background: {{color}}'><\/span><\/div><\/div \/>" 2181 }, 2182 addOnDuotone: { 2183 enable: false 2184 }, 2185 addOnBubblemorph: { 2186 enable: false 2187 }, 2188 addOnDistortion: { 2189 enable: false 2190 } 2191 2192 }; 2193 2194 PluginRevolutionSlider.prototype = { 2195 initialize: function($el, opts) { 2196 if ($el.data(instanceName)) { 2197 return this; 2198 } 2199 2200 this.$el = $el; 2201 2202 this 2203 .setData() 2204 .setOptions(opts) 2205 .build() 2206 .events(); 2207 2208 return this; 2209 }, 2210 2211 setData: function() { 2212 this.$el.data(instanceName, this); 2213 2214 return this; 2215 }, 2216 2217 setOptions: function(opts) { 2218 this.options = $.extend(true, {}, PluginRevolutionSlider.defaults, opts, { 2219 wrapper: this.$el 2220 }); 2221 2222 return this; 2223 }, 2224 2225 build: function() { 2226 if (!($.isFunction($.fn.revolution))) { 2227 return this; 2228 } 2229 2230 // Single Slider Class 2231 if(this.options.wrapper.find('> ul > li').length == 1) { 2232 this.options.wrapper.addClass('slider-single-slide'); 2233 2234 // Remove Bullets 2235 // this.options.navigation.bullets.enable = false; 2236 $.extend(this.options.navigation, { 2237 bullets: { 2238 enable: false 2239 } 2240 }); 2241 2242 } 2243 2244 // Full Screen Class 2245 if(this.options.sliderLayout == 'fullscreen') { 2246 this.options.wrapper.closest('.slider-container').addClass('fullscreen-slider'); 2247 } 2248 2249 // Initialize Revolution Slider 2250 this.options.wrapper.revolution(this.options); 2251 2252 // Addon Init - Typewriter 2253 if(this.options.addOnTypewriter.enable) { 2254 RsTypewriterAddOn($, this.options.wrapper); 2255 } 2256 2257 // Addon Init - Whiteboard 2258 if(this.options.addOnWhiteboard.enable) { 2259 this.options.wrapper.rsWhiteBoard(); 2260 } 2261 2262 // Addon Init - Particles 2263 if(this.options.addOnParticles.enable) { 2264 RsParticlesAddOn(this.options.wrapper); 2265 } 2266 2267 // Addon Init - Countdown 2268 if(this.options.addOnCountdown.enable) { 2269 tp_countdown(this.options.wrapper, this.options.addOnCountdown.targetdate, this.options.addOnCountdown.slidechanges); 2270 } 2271 2272 // Addon Init - Slicey 2273 if(this.options.addOnSlicey.enable) { 2274 this.options.wrapper.revSliderSlicey(); 2275 } 2276 2277 // Addon Init - Filmstrip 2278 if(this.options.addOnFilmstrip.enable) { 2279 RsFilmstripAddOn($, this.options.wrapper, '../vendor/rs-plugin/revolution-addons/filmstrip/', false); 2280 } 2281 2282 // Addon Init - Before After
2283 if(this.options.addOnBeforeAfter.enable) { 2284 RevSliderBeforeAfter($, this.options.wrapper, this.options.addOnBeforeAfter.options); 2285 } 2286 2287 // Addon Init - Panorama 2288 if(this.options.addOnPanorama.enable) { 2289 RsAddonPanorama($, this.options.wrapper); 2290 } 2291 2292 // Addon Init - Revealer 2293 if(this.options.addOnRevealer.enable) { 2294 RsRevealerAddOn($, this.options.wrapper, this.options.revealer.spinnerHtml); 2295 } 2296 2297 // Addon Init - Duotone 2298 if(this.options.addOnDuotone.enable) { 2299 RsAddonDuotone($, this.options.wrapper, true, "cubic-bezier(0.645, 0.045, 0.355, 1.000)", "1000"); 2300 } 2301 2302 // Addon Init - Bubblemorph 2303 if(this.options.addOnBubblemorph.enable) { 2304 BubbleMorphAddOn($, this.options.wrapper, false); 2305 } 2306 2307 // Addon Init - Distortion 2308 if(this.options.addOnDistortion.enable) { 2309 RsLiquideffectAddOn($, this.options.wrapper); 2310 } 2311 2312 return this; 2313 }, 2314 2315 events: function() { 2316 2317 return this; 2318 } 2319 }; 2320 2321 // expose to scope 2322 $.extend(theme, { 2323 PluginRevolutionSlider: PluginRevolutionSlider 2324 }); 2325 2326 // jquery plugin 2327 $.fn.themePluginRevolutionSlider = function(opts) { 2328 return this.map(function() { 2329 var $this = $(this); 2330 2331 if ($this.data(instanceName)) { 2332 return $this.data(instanceName); 2333 } else { 2334 return new PluginRevolutionSlider($this, opts); 2335 } 2336 2337 }); 2338 } 2339 2340}).apply(this, [window.theme, jQuery]); 2341 2342// Scroll to Top 2343(function(theme, $) { 2344 2345 theme = theme || {}; 2346 2347 $.extend(theme, { 2348 2349 PluginScrollToTop: { 2350 2351 defaults: { 2352 wrapper: $('body'), 2353 offset: 150, 2354 buttonClass: 'scroll-to-top', 2355 iconClass: 'fas fa-chevron-up', 2356 delay: 1000, 2357 visibleMobile: false, 2358 label: false, 2359 easing: 'easeOutBack' 2360 }, 2361 2362 initialize: function(opts) { 2363 initialized = true; 2364 2365 // Don't initialize if the page has Section Scroll 2366 if( $('body[data-plugin-section-scroll]').get(0) ) { 2367 return; 2368 } 2369 2370 this 2371 .setOptions(opts) 2372 .build() 2373 .events(); 2374 2375 return this; 2376 }, 2377 2378 setOptions: function(opts) { 2379 this.options = $.extend(true, {}, this.defaults, opts); 2380 2381 return this; 2382 }, 2383 2384 build: function() { 2385 var self = this, 2386 $el; 2387 2388 // Base HTML Markup 2389 $el = $('<a />') 2390 .addClass(self.options.buttonClass) 2391 .attr({ 2392 'href': '#', 2393 }) 2394 .append( 2395 $('<i />') 2396 .addClass(self.options.iconClass) 2397 ); 2398 2399 // Visible Mobile 2400 if (!self.options.visibleMobile) { 2401 $el.addClass('hidden-mobile'); 2402 } 2403 2404 // Label 2405 if (self.options.label) { 2406 $el.append( 2407 $('<span />').html(self.options.label) 2408 ); 2409 } 2410 2411 this.options.wrapper.append($el); 2412 2413 this.$el = $el; 2414 2415 return this; 2416 }, 2417 2418 events: function() { 2419 var self = this, 2420 _isScrolling = false; 2421 2422 // Click Element Action 2423 self.$el.on('click', function(e) { 2424 e.preventDefault(); 2425 $('body, html').animate({ 2426 scrollTop: 0 2427 }, self.options.delay, self.options.easing); 2428 return false; 2429 }); 2430 2431 // Show/Hide Button on Window Scroll event. 2432 $(window).scroll(function() { 2433 2434 if (!_isScrolling) { 2435 2436 _isScrolling = true; 2437 2438 if ($(window).scrollTop() > self.options.offset) { 2439 2440 self.$el.stop(true, true).addClass('visible'); 2441 _isScrolling = false; 2442 2443 } else { 2444 2445 self.$el.stop(true, true).removeClass('visible'); 2446 _isScrolling = false; 2447 2448 } 2449 2450 } 2451 2452 }); 2453 2454 return this; 2455 } 2456 2457 } 2458 2459 }); 2460 2461}).apply(this, [window.theme, jQuery]); 2462 2463// Scrollable 2464(function(theme, $) { 2465 2466 theme = theme || {}; 2467 2468 var instanceName = '__scrollable'; 2469 2470 var PluginScrollable = function($el, opts) { 2471 return this.initialize($el, opts); 2472 }; 2473 2474 PluginScrollable.updateModals = function() { 2475 PluginScrollable.updateBootstrapModal(); 2476 }; 2477 2478 PluginScrollable.updateBootstrapModal = function() { 2479 var updateBoostrapModal; 2480 2481 updateBoostrapModal = typeof $.fn.modal !== 'undefined'; 2482 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor !== 'undefined'; 2483 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype !== 'undefined'; 2484 updateBoostrapModal = updateBoostrapModal && typeof $.fn.modal.Constructor.prototype.enforceFocus !== 'undefined'; 2485 2486 if ( !updateBoostrapModal ) { 2487 return false;
2488 } 2489 2490 var originalFocus = $.fn.modal.Constructor.prototype.enforceFocus; 2491 $.fn.modal.Constructor.prototype.enforceFocus = function() { 2492 originalFocus.apply( this ); 2493 2494 var $scrollable = this.$element.find('.scrollable'); 2495 if ( $scrollable ) { 2496 if ( $.isFunction($.fn['themePluginScrollable']) ) { 2497 $scrollable.themePluginScrollable(); 2498 } 2499 2500 if ( $.isFunction($.fn['nanoScroller']) ) { 2501 $scrollable.nanoScroller(); 2502 } 2503 } 2504 }; 2505 }; 2506 2507 PluginScrollable.defaults = { 2508 contentClass: 'scrollable-content', 2509 paneClass: 'scrollable-pane', 2510 sliderClass: 'scrollable-slider', 2511 alwaysVisible: true, 2512 preventPageScrolling: true 2513 }; 2514 2515 PluginScrollable.prototype = { 2516 initialize: function($el, opts) { 2517 if ( $el.data( instanceName ) ) { 2518 return this; 2519 } 2520 2521 this.$el = $el; 2522 2523 this 2524 .setData() 2525 .setOptions(opts) 2526 .build(); 2527 2528 return this; 2529 }, 2530 2531 setData: function() { 2532 this.$el.data(instanceName, this); 2533 2534 return this; 2535 }, 2536 2537 setOptions: function(opts) { 2538 this.options = $.extend(true, {}, PluginScrollable.defaults, opts, { 2539 wrapper: this.$el 2540 }); 2541 2542 return this; 2543 }, 2544 2545 build: function() { 2546 this.options.wrapper.nanoScroller(this.options); 2547 2548 return this; 2549 } 2550 }; 2551 2552 // expose to scope 2553 $.extend(theme, { 2554 PluginScrollable: PluginScrollable 2555 }); 2556 2557 // jquery plugin 2558 $.fn.themePluginScrollable = function(opts) { 2559 return this.each(function() { 2560 var $this = $(this); 2561 2562 if ($this.data(instanceName)) { 2563 return $this.data(instanceName); 2564 } else { 2565 return new PluginScrollable($this, opts); 2566 } 2567 2568 }); 2569 }; 2570 2571 $(function() { 2572 PluginScrollable.updateModals(); 2573 }); 2574 2575}).apply(this, [window.theme, jQuery]); 2576 2577// Section Scroll 2578(function(theme, $) { 2579 2580 theme = theme || {}; 2581 2582 var instanceName = '__sectionScroll'; 2583 2584 var PluginSectionScroll = function($el, opts) { 2585 return this.initialize($el, opts); 2586 }; 2587 2588 PluginSectionScroll.defaults = { 2589 targetClass: '.section', 2590 dotsNav: true, 2591 changeHeaderLogo: true, 2592 headerLogoDark: 'img/logo-default-slim.png', 2593 headerLogoLight: 'img/logo-default-slim-dark.png' 2594 }; 2595 2596 PluginSectionScroll.prototype = { 2597 initialize: function($el, opts) { 2598 if ($el.data(instanceName)) { 2599 return this; 2600 } 2601 2602 this.$el = $el; 2603 2604 this 2605 .setData() 2606 .setOptions(opts) 2607 .build() 2608 .events(); 2609 2610 return this; 2611 }, 2612 2613 setData: function() { 2614 this.$el.data(instanceName, this); 2615 2616 return this; 2617 }, 2618 2619 setOptions: function(opts) { 2620 this.options = $.extend(true, {}, PluginSectionScroll.defaults, opts, { 2621 wrapper: this.$el 2622 }); 2623 2624 return this; 2625 }, 2626 2627 build: function() { 2628 var self = this, 2629 $el = this.options.wrapper; 2630 2631 // Check type of header and change the target for header (by change header color purpose) 2632 if( $('html').hasClass('side-header-overlay-full-screen') ) { 2633 self.$header = $('.sticky-wrapper'); 2634 } else { 2635 self.$header = $('#header'); 2636 } 2637 2638 // Turn the section full height or not depeding on the content size 2639 self.updateSectionsHeight(); 2640 2641 // Wrap all sections in a section wrapper 2642 $( this.options.targetClass ).wrap('<div class="section-wrapper"></div>'); 2643 2644 // Set the section wrapper height 2645 $('.section-wrapper').each(function(){ 2646 $(this).height( $(this).find('.section-scroll').outerHeight() ); 2647 }); 2648 2649 // Add active class to the first section on page load 2650 $('.section-wrapper').first().addClass('active'); 2651 2652 var flag = false, 2653 scrollableFlag = false, 2654 touchDirection = '', 2655 touchstartY = 0, 2656 touchendY = 0; 2657 2658 $(window).on('touchstart', function(event) { 2659 touchstartY = event.changedTouches[0].screenY; 2660 }); 2661 2662 var wheelEvent = 'onwheel' in document ? 'wheel' : document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll'; 2663 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 2664 wheelEvent = 'onwheel' in document ? 'wheel touchend' : document.onmousewheel !== undefined ? 'mousewheel touchend' : 'DOMMouseScroll touchend'; 2665 } 2666 2667 $(window).on(wheelEvent, function(e){ 2668 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 2669 if( $(e.target).closest('.section-scroll-dots-navigation').get(0) || $(e.target).closest('.header-body').get(0) || $(e.target).closest('.owl-carousel').get(0) ) { 2670 return; 2671 } 2672 } 2673 2674 // Side Header Overlay Full Screen 2675 if( $('html.side-header-overlay-full-screen.side-header-hide').get(0) ) { 2676 return; 2677 } 2678 2679 var wheelDirection = e.originalEvent.wheelDelta == undefined ? e.originalEvent.deltaY > 0 : e.originalEvent.wheelDelta < 0; 2680 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 2681 touchendY = event.changedTouches[0].screenY; 2682 2683 if( touchendY <= touchstartY ) { 2684 touchDirection = 'up'; 2685 } 2686 2687 if( touchendY >= touchstartY ) { 2688 touchDirection = 'down'; 2689 } 2690 2691 if( touchendY == touchstartY ) { 2692 return; 2693 } 2694 } 2695 2696 var $currentSection = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'), 2697 $nextSection = self.getNextSection(wheelDirection, touchDirection), 2698 nextSectionOffsetTop; 2699 2700 // If is the last section, then change the offsetTop value
2701 if( self.getCurrentIndex() == $('.section-wrapper').length - 1 ) { 2702 nextSectionOffsetTop = $(document).height(); 2703 } else { 2704 nextSectionOffsetTop = $nextSection.offset().top; 2705 } 2706 2707 if( $(window).width() < 992 && $('html').hasClass('touch') ) { 2708 setTimeout(function(){ 2709 if( $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').hasClass('section-scroll-scrollable') ) { 2710 $('html').removeClass('overflow-hidden'); 2711 } else { 2712 $('html').addClass('overflow-hidden'); 2713 } 2714 }, 1200); 2715 } 2716 2717 // For non full height sections 2718 if( $currentSection.hasClass('section-scroll-scrollable') ) { 2719 if( !flag && !scrollableFlag ) { 2720 2721 // Scroll Direction 2722 if(wheelDirection || touchDirection == 'up') { 2723 if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) { 2724 flag = true; 2725 setTimeout(function(){ 2726 $(window).trigger('section.scroll.change.header.color'); 2727 2728 setTimeout(function(){ 2729 flag = false; 2730 }, 500); 2731 }, 1000); 2732 2733 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 ) ) { 2734 return false; 2735 } 2736 2737 // Move to the next section 2738 self.moveTo( $currentSection.offset().top + $currentSection.outerHeight() ); 2739 2740 // Change Section Active Class 2741 self.changeSectionActiveState( $nextSection ); 2742 2743 self.$header.css({ 2744 opacity: 0, 2745 transition: 'ease opacity 500ms' 2746 }); 2747 } 2748 2749 if( !$('html').hasClass('touch') ) { 2750 for( var i = 1; i < 100; i++ ) { 2751 $('body, html').scrollTop( $(window).scrollTop() + 1 ); 2752 2753 if( ( $(window).scrollTop() + $(window).height() ) >= nextSectionOffsetTop ) { 2754 scrollableFlag = true; 2755 setTimeout(function(){ 2756 $(window).trigger('section.scroll.change.header.color'); 2757 scrollableFlag = false; 2758 }, 500); 2759 break; 2760 } 2761 } 2762 } 2763 } else { 2764 if( $(window).scrollTop() <= $currentSection.offset().top ) { 2765 flag = true; 2766 setTimeout(function(){ 2767 $(window).trigger('section.scroll.change.header.color'); 2768 2769 setTimeout(function(){ 2770 flag = false; 2771 }, 500); 2772 }, 1000); 2773 2774 if( self.getCurrentIndex() == 0 ) { 2775 return false; 2776 } 2777 2778 // Move to the next section 2779 self.moveTo( $currentSection.offset().top - $(window).height() ); 2780 2781 // Change Section Active Class 2782 self.changeSectionActiveState( $nextSection ); 2783 2784 self.$header.css({ 2785 opacity: 0, 2786 transition: 'ease opacity 500ms' 2787 }); 2788 } 2789 2790 if( !$('html').hasClass('touch') ) { 2791 for( var i = 1; i < 100; i++ ) { 2792 $('body, html').scrollTop( $(window).scrollTop() - 1 ); 2793 2794 if( $(window).scrollTop() <= $currentSection.offset().top ) { 2795 scrollableFlag = true; 2796 setTimeout(function(){ 2797 $(window).trigger('section.scroll.change.header.color'); 2798 scrollableFlag = false; 2799 }, 500); 2800 break; 2801 } 2802 } 2803 } 2804 } 2805 2806 // Change Dots Active Class 2807 self.changeDotsActiveState(); 2808 2809 return; 2810 2811 } 2812 } 2813 2814 // For full height sections 2815 if( !flag && !scrollableFlag ) { 2816 if(wheelDirection || touchDirection == 'up') { 2817 if( self.getCurrentIndex() == ( $('.section-wrapper').length - 1 ) ) { 2818 return false; 2819 } 2820 2821 // Change Section Active Class 2822 self.changeSectionActiveState( $nextSection ); 2823 2824 setTimeout(function(){ 2825 // Move to the next section 2826 self.moveTo( $nextSection.offset().top ); 2827 2828 }, 150); 2829 } else { 2830 if( self.getCurrentIndex() == 0 ) { 2831 return false;
2832 } 2833 2834 // Change Section Active Class 2835 self.changeSectionActiveState( $nextSection ); 2836 2837 if( $nextSection.height() > $(window).height() ) { 2838 // Move to the next section 2839 self.moveTo( $currentSection.offset().top - $(window).height() ); 2840 } else { 2841 setTimeout(function(){ 2842 // Move to the next section 2843 self.moveTo( $nextSection.offset().top ); 2844 2845 }, 150); 2846 } 2847 } 2848 2849 // Change Dots Active Class 2850 self.changeDotsActiveState(); 2851 2852 self.$header.css({ 2853 opacity: 0, 2854 transition: 'ease opacity 500ms' 2855 }); 2856 2857 // Style next section 2858 $nextSection.css({ 2859 position: 'relative', 2860 opacity: 1, 2861 'z-index': 1, 2862 transform: 'translate3d(0,0,0) scale(1)' 2863 }); 2864 2865 // Style previous section 2866 $currentSection.css({ 2867 position: 'fixed', 2868 width: '100%', 2869 top: 0, 2870 left: 0, 2871 opacity: 0, 2872 'z-index': 0, 2873 transform: 'translate3d(0,0,-10px) scale(0.7)', 2874 transition: 'ease transform 600ms, ease opacity 600ms', 2875 }); 2876 2877 setTimeout(function(){ 2878 $currentSection.css({ 2879 position: 'relative', 2880 opacity: 1, 2881 transform: 'translate3d(0,0,-10px) scale(1)' 2882 }); 2883 2884 $(window).trigger('section.scroll.change.header.color'); 2885 2886 setTimeout(function(){ 2887 flag = false; 2888 }, 500); 2889 }, 1000); 2890 2891 flag = true; 2892 2893 } 2894 2895 return; 2896 }); 2897 2898 // Dots Navigation 2899 if( this.options.dotsNav ) { 2900 self.dotsNavigation(); 2901 } 2902 2903 // First Load 2904 setTimeout(function(){ 2905 if( $(window.location.hash).get(0) ) { 2906 self.moveTo( $(window.location.hash).parent().offset().top ); 2907 2908 self.changeSectionActiveState( $(window.location.hash) ); 2909 2910 // Change Dots Active Class 2911 self.changeDotsActiveState(); 2912 2913 self.updateHash( true ); 2914 } else { 2915 var hash = window.location.hash, 2916 index = hash.replace('#',''); 2917 2918 if( !hash ) { 2919 index = 1; 2920 } 2921 2922 self.moveTo( $('.section-wrapper').eq( index - 1 ).offset().top ); 2923 2924 self.changeSectionActiveState( $('.section-wrapper').eq( index - 1 ).find('.section-scroll') ); 2925 2926 // Change Dots Active Class 2927 self.changeDotsActiveState(); 2928 2929 self.updateHash( true ); 2930 } 2931 2932 $(window).trigger('section.scroll.ready'); 2933 }, 500); 2934 2935 return this; 2936 }, 2937 2938 updateSectionsHeight: function() { 2939 var self = this; 2940 2941 $('.section-scroll').css({ height: '' }); 2942 2943 $('.section-scroll').each(function(){ 2944 if( $(this).outerHeight() < ( $(window).height() + 3 ) ) { 2945 $(this).css({ height: '100vh' }); 2946 } else { 2947 $(this).addClass('section-scroll-scrollable'); 2948 } 2949 }); 2950 2951 // Set the section wrapper height 2952 $('.section-wrapper').each(function(){ 2953 $(this).height( $(this).find('.section-scroll').outerHeight() ); 2954 }); 2955 2956 return this; 2957 }, 2958 2959 updateHash: function( first_load ){ 2960 var self = this; 2961 2962 if( !window.location.hash ) { 2963 window.location.hash = 1; 2964 } else { 2965 if(!first_load) { 2966 var $section = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll'), 2967 section_id = $section.attr('id') ? $section.attr('id') : $section.parent().index() + 1; 2968 2969 window.location.hash = section_id; 2970 } 2971 } 2972 2973 return this; 2974 }, 2975 2976 getCurrentIndex: function() { 2977 var self = this, 2978 currentIndex = 0; 2979 2980 currentIndex = $('.section-wrapper.active').index(); 2981 2982 return currentIndex; 2983 }, 2984 2985 moveTo: function( $scrollTopValue, first_load ) { 2986 var self = this; 2987 2988 $('body, html').animate({ 2989 scrollTop: $scrollTopValue 2990 }, 1000, 'easeOutQuint'); 2991 2992 setTimeout(function(){ 2993 self.updateHash(); 2994 }, 500); 2995 2996 return this; 2997 }, 2998 2999 getNextSection: function(wheelDirection, touchDirection) { 3000 var self = this, 3001 $nextSection = ''; 3002 3003 // Scroll Direction 3004 if(wheelDirection || touchDirection == 'up') { 3005 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() + 1 ).find('.section-scroll'); 3006 } else { 3007 $nextSection = $('.section-wrapper').eq( self.getCurrentIndex() - 1 ).find('.section-scroll'); 3008 } 3009 3010 return $nextSection; 3011 }, 3012 3013 changeSectionActiveState: function( $nextSection ) { 3014 var self = this; 3015 3016 $('.section-wrapper').removeClass('active'); 3017 $nextSection.parent().addClass('active'); 3018 3019 return this; 3020 }, 3021 3022 changeDotsActiveState: function() { 3023 var self = this; 3024 3025 $('.section-scroll-dots-navigation > ul > li').removeClass('active'); 3026 $('.section-scroll-dots-navigation > ul > li').eq( self.getCurrentIndex() ).addClass('active'); 3027 3028 return this; 3029 }, 3030 3031 dotsNavigation: function() { 3032 var self = this; 3033
3034 var dotsNav = $('<div class="section-scroll-dots-navigation"><ul class="list list-unstyled"></ul></div>'), 3035 currentSectionIndex = self.getCurrentIndex(); 3036 3037 if( self.options.dotsClass ) { 3038 dotsNav.addClass( self.options.dotsClass ); 3039 } 3040 3041 for( var i = 0; i < $('.section-scroll').length; i++ ) { 3042 var title = $('.section-wrapper').eq( i ).find('.section-scroll').data('section-scroll-title'); 3043 3044 dotsNav.find('> ul').append( '<li'+ ( ( currentSectionIndex == i ) ? ' class="active"' : '' ) +'><a href="#'+ i +'" data-nav-id="'+ i +'"><span>'+ title +'</span></a></li>' ); 3045 } 3046 3047 $('.body').append( dotsNav ); 3048 3049 dotsNav.find('a[data-nav-id]').on('click touchstart', function(e){ 3050 e.preventDefault(); 3051 var $this = $(this); 3052 3053 $('.section-scroll').css({ 3054 opacity: 0, 3055 transition: 'ease opacity 300ms' 3056 }); 3057 3058 self.$header.css({ 3059 opacity: 0, 3060 transition: 'ease opacity 500ms' 3061 }); 3062 3063 setTimeout(function(){ 3064 self.moveTo( $('.section-wrapper').eq( $this.data('nav-id') ).offset().top ) 3065 3066 $('.section-wrapper').removeClass('active'); 3067 $('.section-wrapper').eq( $this.data('nav-id') ).addClass('active'); 3068 3069 $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').css({ 3070 opacity: 1 3071 }); 3072 3073 setTimeout(function(){ 3074 $('.section-scroll').css({ opacity: 1 }); 3075 3076 $(window).trigger('section.scroll.change.header.color'); 3077 }, 500); 3078 3079 self.changeDotsActiveState(); 3080 }, 500); 3081 }); 3082 3083 return this; 3084 }, 3085 3086 events: function() { 3087 var self = this; 3088 3089 $(window).on('section.scroll.ready', function(){ 3090 $(window).scrollTop(0); 3091 }); 3092 3093 $(window).on('section.scroll.change.header.color', function(){ 3094 var headerColor = $('.section-wrapper').eq( self.getCurrentIndex() ).find('.section-scroll').data('section-scroll-header-color'); 3095 3096 $('#header .header-nav').removeClass('header-nav-light-text header-nav-dark-text').addClass('header-nav-' + headerColor + '-text'); 3097 $('#header .header-nav-features').removeClass('header-nav-features-dark header-nav-features-light').addClass('header-nav-features-' + headerColor); 3098 $('#header .header-social-icons').removeClass('social-icons-icon-dark social-icons-icon-light').addClass('social-icons-icon-' + headerColor); 3099 3100 // Change Logo 3101 if( self.options.changeHeaderLogo && headerColor != undefined ) { 3102 if( headerColor == 'light' ) { 3103 $('#header .header-logo img').attr('src', self.options.headerLogoLight); 3104 } else if( headerColor == 'dark' ) { 3105 $('#header .header-logo img').attr('src', self.options.headerLogoDark); 3106 } 3107 } 3108 3109 self.$header.css({ 3110 opacity: 1 3111 }); 3112 }); 3113 3114 $(document).ready(function(){ 3115 $(window).afterResize(function(){ 3116 self.updateSectionsHeight(); 3117 }); 3118 }); 3119 3120 return this; 3121 } 3122 }; 3123 3124 // expose to scope 3125 $.extend(theme, { 3126 PluginSectionScroll: PluginSectionScroll 3127 }); 3128 3129 // jquery plugin 3130 $.fn.themePluginSectionScroll = function(opts) { 3131 return this.map(function() { 3132 var $this = $(this); 3133 3134 if ($this.data(instanceName)) { 3135 return $this.data(instanceName); 3136 } else { 3137 return new PluginSectionScroll($this, opts); 3138 } 3139 3140 }); 3141 }; 3142 3143}).apply(this, [window.theme, jQuery]); 3144 3145// Sort 3146(function(theme, $) { 3147 3148 theme = theme || {}; 3149 3150 var instanceName = '__sort'; 3151 3152 var PluginSort = function($el, opts) { 3153 return this.initialize($el, opts); 3154 }; 3155 3156 PluginSort.defaults = { 3157 useHash: true, 3158 itemSelector: '.isotope-item', 3159 layoutMode: 'masonry', 3160 filter: '*', 3161 hiddenStyle: { 3162 opacity: 0 3163 }, 3164 visibleStyle: { 3165 opacity: 1 3166 }, 3167 stagger: 30, 3168 isOriginLeft: ($('html').attr('dir') == 'rtl' ? false : true) 3169 }; 3170 3171 PluginSort.prototype = { 3172 initialize: function($el, opts) { 3173 if ($el.data(instanceName)) { 3174 return this; 3175 } 3176 3177 this.$el = $el; 3178 3179 this 3180 .setData() 3181 .setOptions(opts) 3182 .build(); 3183 3184 return this; 3185 }, 3186 3187 setData: function() { 3188 this.$el.data(instanceName, this); 3189 3190 return this; 3191 }, 3192 3193 setOptions: function(opts) { 3194 this.options = $.extend(true, {}, PluginSort.defaults, opts, { 3195 wrapper: this.$el 3196 }); 3197 3198 return this; 3199 }, 3200 3201 build: function() { 3202 if (!($.isFunction($.fn.isotope))) { 3203 return this; 3204 } 3205 3206 var self = this, 3207 $source = this.options.wrapper, 3208 $destination = $('.sort-destination[data-sort-id="' + $source.attr('data-sort-id') + '"]'), 3209 $window = $(window); 3210 3211 if ($destination.get(0)) { 3212 3213 self.$source = $source; 3214 self.$destination = $destination; 3215 self.$loader = false;
3216 3217 self.setParagraphHeight($destination); 3218 3219 if (self.$destination.parents('.sort-destination-loader').get(0)) { 3220 self.$loader = self.$destination.parents('.sort-destination-loader'); 3221 self.createLoader(); 3222 } 3223 3224 $destination.attr('data-filter', '*'); 3225 3226 $destination.one('layoutComplete', function(event, laidOutItems) { 3227 self.removeLoader(); 3228 }); 3229 3230 // IE10/11 fix 3231 if( $('html').hasClass('ie10') || $('html').hasClass('ie11') ) { 3232 var padding = parseInt( self.options.wrapper.children().css('padding-left') ) + parseInt( self.options.wrapper.children().css('padding-right') ); 3233 } 3234 3235 $destination.waitForImages(function() { 3236 $destination.isotope(self.options); 3237 self.events(); 3238 }); 3239 3240 3241 setTimeout(function() { 3242 self.removeLoader(); 3243 }, 3000); 3244 3245 } 3246 3247 return this; 3248 }, 3249 3250 events: function() { 3251 var self = this, 3252 filter = null, 3253 $window = $(window); 3254 3255 self.$source.find('a').click(function(e) { 3256 e.preventDefault(); 3257 3258 filter = $(this).parent().data('option-value'); 3259 3260 self.setFilter(filter); 3261 3262 if (e.originalEvent) { 3263 self.$source.trigger('filtered'); 3264 } 3265 3266 return this; 3267 }); 3268 3269 self.$destination.trigger('filtered'); 3270 self.$source.trigger('filtered'); 3271 3272 if (self.options.useHash) { 3273 self.hashEvents(); 3274 } 3275 3276 $window.on('resize', function() { 3277 setTimeout(function() { 3278 self.$destination.isotope('layout'); 3279 }, 300); 3280 }); 3281 3282 setTimeout(function() { 3283 $window.trigger('resize'); 3284 }, 300); 3285 3286 return this; 3287 }, 3288 3289 setFilter: function(filter) { 3290 var self = this, 3291 page = false, 3292 currentFilter = filter; 3293 3294 self.$source.find('.active').removeClass('active'); 3295 self.$source.find('li[data-option-value="' + filter + '"], li[data-option-value="' + filter + '"] > a').addClass('active'); 3296 3297 self.options.filter = currentFilter; 3298 3299 if (self.$destination.attr('data-current-page')) { 3300 currentFilter = currentFilter + '[data-page-rel=' + self.$destination.attr('data-current-page') + ']'; 3301 } 3302 3303 self.$destination.attr('data-filter', filter).isotope({ 3304 filter: currentFilter 3305 }).one('arrangeComplete', function( event, filteredItems ) { 3306 3307 if (self.options.useHash) { 3308 if (window.location.hash != '' || self.options.filter.replace('.', '') != '*') { 3309 window.location.hash = self.options.filter.replace('.', ''); 3310 } 3311 } 3312 3313 $(window).trigger('scroll'); 3314 3315 }).trigger('filtered'); 3316 3317 return this; 3318 }, 3319 3320 hashEvents: function() { 3321 var self = this, 3322 hash = null, 3323 hashFilter = null, 3324 initHashFilter = '.' + location.hash.replace('#', ''); 3325 3326 if (initHashFilter != '.' && initHashFilter != '.*') { 3327 self.setFilter(initHashFilter); 3328 } 3329 3330 $(window).on('hashchange', function(e) { 3331 3332 hashFilter = '.' + location.hash.replace('#', ''); 3333 hash = (hashFilter == '.' || hashFilter == '.*' ? '*' : hashFilter); 3334 3335 self.setFilter(hash); 3336 3337 }); 3338 3339 return this; 3340 }, 3341 3342 setParagraphHeight: function() { 3343 var self = this, 3344 minParagraphHeight = 0, 3345 paragraphs = $('span.thumb-info-caption p', self.$destination); 3346 3347 paragraphs.each(function() { 3348 if ($(this).height() > minParagraphHeight) { 3349 minParagraphHeight = ($(this).height() + 10); 3350 } 3351 }); 3352 3353 paragraphs.height(minParagraphHeight); 3354 3355 return this; 3356 }, 3357 3358 createLoader: function() { 3359 var self = this; 3360 3361 var loaderTemplate = [ 3362 '<div class="bounce-loader">', 3363 '<div class="bounce1"></div>', 3364 '<div class="bounce2"></div>', 3365 '<div class="bounce3"></div>', 3366 '</div>' 3367 ].join(''); 3368 3369 self.$loader.append(loaderTemplate); 3370 3371 return this; 3372 }, 3373 3374 removeLoader: function() { 3375 3376 var self = this; 3377 3378 if (self.$loader) { 3379 3380 self.$loader.removeClass('sort-destination-loader-showing'); 3381 3382 setTimeout(function() { 3383 self.$loader.addClass('sort-destination-loader-loaded'); 3384 }, 300); 3385 3386 } 3387 3388 } 3389 3390 }; 3391 3392 // expose to scope 3393 $.extend(theme, { 3394 PluginSort: PluginSort 3395 }); 3396 3397 // jquery plugin 3398 $.fn.themePluginSort = function(opts) { 3399 return this.map(function() { 3400 var $this = $(this); 3401 3402 if ($this.data(instanceName)) { 3403 return $this.data(instanceName); 3404 } else { 3405 return new PluginSort($this, opts); 3406 } 3407 3408 }); 3409 } 3410 3411}).apply(this, [window.theme, jQuery]); 3412 3413// Star Rating 3414(function(theme, $) { 3415 3416 theme = theme || {}; 3417 3418 var instanceName = '__starrating'; 3419 3420 var PluginStarRating = function($el, opts) { 3421 return this.initialize($el, opts); 3422 }; 3423 3424 PluginStarRating.defaults = { 3425 theme: 'krajee-fas', 3426 color: 'primary', 3427 showClear: false, 3428 showCaption: false 3429 }; 3430 3431 PluginStarRating.prototype = { 3432 initialize: function($el, opts) { 3433 this.$el = $el; 3434 3435 this 3436 .setData() 3437 .setOptions(opts) 3438 .build(); 3439 3440 return this; 3441 }, 3442 3443 setData: function() { 3444 this.$el.data(instanceName, this); 3445 3446 return this; 3447 }, 3448 3449 setOptions: function(opts) { 3450 this.options = $.extend(true, {}, PluginStarRating.defaults, opts, { 3451 wrapper: this.$el 3452 }); 3453 3454 return this; 3455 }, 3456 3457 build: function() { 3458 3459 if (!($.isFunction($.fn.rating))) { 3460 return this; 3461 } 3462 3463 var self = this; 3464 3465 self.options.wrapper 3466 .rating(self.options); 3467 3468 self.options.wrapper.parents('.rating-container') 3469 .addClass('rating-' + self.options.color); 3470 3471 return this; 3472 3473 } 3474 }; 3475 3476 // expose to scope 3477 $.extend(theme, { 3478 PluginStarRating: PluginStarRating 3479 }); 3480 3481 // jquery plugin 3482 $.fn.themePluginStarRating = function(opts) { 3483 return this.map(function() { 3484 var $this = $(this); 3485 3486 if ($this.data(instanceName)) { 3487 return $this.data(instanceName); 3488 } else { 3489 return new PluginStarRating($this, opts); 3490 } 3491 3492 }); 3493 } 3494 3495}).apply(this, [window.theme, jQuery]); 3496 3497// Sticky 3498(function(theme, $) { 3499 3500 theme = theme || {}; 3501 3502 var instanceName = '__sticky'; 3503 3504 var PluginSticky = function($el, opts) { 3505 return this.initialize($el, opts); 3506 }; 3507 3508 PluginSticky.defaults = { 3509 minWidth: 991, 3510 activeClass: 'sticky-active' 3511 }; 3512 3513 PluginSticky.prototype = { 3514 initialize: function($el, opts) { 3515 if ( $el.data( instanceName ) ) { 3516 return this; 3517 } 3518 3519 this.$el = $el; 3520 3521 this 3522 .setData() 3523 .setOptions(opts) 3524 .build() 3525 .events(); 3526 3527 return this; 3528 }, 3529 3530 setData: function() { 3531 this.$el.data(instanceName, this); 3532 3533 return this; 3534 }, 3535 3536 setOptions: function(opts) { 3537 this.options = $.extend(true, {}, PluginSticky.defaults, opts, { 3538 wrapper: this.$el 3539 }); 3540 3541 return this; 3542 }, 3543 3544 build: function() { 3545 if (!($.isFunction($.fn.pin))) { 3546 return this; 3547 } 3548 3549 var self = this, 3550 $window = $(window); 3551 3552 self.options.wrapper.pin(self.options); 3553 3554 if( self.options.wrapper.hasClass('sticky-wrapper-transparent') ) { 3555 self.options.wrapper.parent().addClass('position-absolute w-100'); 3556 } 3557 3558 $window.afterResize(function() { 3559 self.options.wrapper.removeAttr('style').removeData('pin'); 3560 self.options.wrapper.pin(self.options); 3561 $window.trigger('scroll'); 3562 }); 3563 3564 // Change Logo Src 3565 if( self.options.wrapper.find('img').attr('data-change-src') ) { 3566 var $logo = self.options.wrapper.find('img'), 3567 logoSrc = $logo.attr('src'), 3568 logoNewSrc = $logo.attr('data-change-src'); 3569 3570 self.changeLogoSrc = function(activate) { 3571 if(activate) { 3572 $logo.attr('src', logoNewSrc); 3573 } else { 3574 $logo.attr('src', logoSrc); 3575 } 3576 } 3577 } 3578 3579 return this; 3580 }, 3581 3582 events: function() { 3583 var self = this, 3584 $window = $(window), 3585 $logo = self.options.wrapper.find('img'), 3586 sticky_activate_flag = true, 3587 sticky_deactivate_flag = false, 3588 class_to_check = ( self.options.wrapper.hasClass('sticky-wrapper-effect-1') ) ? 'sticky-effect-active' : 'sticky-active'; 3589 3590 $window.on('scroll sticky.effect.active', function(){ 3591 if( self.options.wrapper.hasClass( class_to_check ) ) { 3592 if( sticky_activate_flag ) { 3593 if( $logo.attr('data-change-src') ) { 3594 self.changeLogoSrc(true); 3595 } 3596 3597 sticky_activate_flag = false;
3598 sticky_deactivate_flag = true; 3599 } 3600 } else { 3601 if( sticky_deactivate_flag ) { 3602 if( $logo.attr('data-change-src') ) { 3603 self.changeLogoSrc(false); 3604 } 3605 3606 sticky_deactivate_flag = false; 3607 sticky_activate_flag = true; 3608 } 3609 } 3610 }); 3611 3612 var is_backing = false; 3613 if( self.options.stickyStartEffectAt ) { 3614 3615 // First Load 3616 if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 3617 self.options.wrapper.addClass('sticky-effect-active'); 3618 3619 $window.trigger('sticky.effect.active'); 3620 } 3621 3622 $window.on('scroll', function(){ 3623 if( self.options.stickyStartEffectAt < $window.scrollTop() ) { 3624 self.options.wrapper.addClass('sticky-effect-active'); 3625 is_backing = true; 3626 3627 $window.trigger('sticky.effect.active'); 3628 } else { 3629 if( is_backing ) { 3630 self.options.wrapper.find('.sticky-body').addClass('position-fixed'); 3631 is_backing = false; 3632 } 3633 3634 if( $window.scrollTop() == 0 ) { 3635 self.options.wrapper.find('.sticky-body').removeClass('position-fixed'); 3636 } 3637 3638 self.options.wrapper.removeClass('sticky-effect-active'); 3639 } 3640 }); 3641 } 3642 } 3643 }; 3644 3645 // expose to scope 3646 $.extend(theme, { 3647 PluginSticky: PluginSticky 3648 }); 3649 3650 // jquery plugin 3651 $.fn.themePluginSticky = function(opts) { 3652 return this.map(function() { 3653 var $this = $(this); 3654 3655 if ($this.data(instanceName)) { 3656 return $this.data(instanceName); 3657 } else { 3658 return new PluginSticky($this, opts); 3659 } 3660 3661 }); 3662 } 3663 3664}).apply(this, [ window.theme, jQuery ]); 3665 3666// Toggle 3667(function(theme, $) { 3668 3669 theme = theme || {}; 3670 3671 var instanceName = '__toggle'; 3672 3673 var PluginToggle = function($el, opts) { 3674 return this.initialize($el, opts); 3675 }; 3676 3677 PluginToggle.defaults = { 3678 duration: 350, 3679 isAccordion: false 3680 }; 3681 3682 PluginToggle.prototype = { 3683 initialize: function($el, opts) { 3684 if ($el.data(instanceName)) { 3685 return this; 3686 } 3687 3688 this.$el = $el; 3689 3690 this 3691 .setData() 3692 .setOptions(opts) 3693 .build(); 3694 3695 return this; 3696 }, 3697 3698 setData: function() { 3699 this.$el.data(instanceName, this); 3700 3701 return this; 3702 }, 3703 3704 setOptions: function(opts) { 3705 this.options = $.extend(true, {}, PluginToggle.defaults, opts, { 3706 wrapper: this.$el 3707 }); 3708 3709 return this; 3710 }, 3711 3712 build: function() { 3713 var self = this, 3714 $wrapper = this.options.wrapper, 3715 $items = $wrapper.find('> .toggle'), 3716 $el = null; 3717 3718 $items.each(function() { 3719 $el = $(this); 3720 3721 if ($el.hasClass('active')) { 3722 $el.find('> p').addClass('preview-active'); 3723 $el.find('> .toggle-content').slideDown(self.options.duration); 3724 } 3725 3726 self.events($el); 3727 }); 3728 3729 if (self.options.isAccordion) { 3730 self.options.duration = self.options.duration / 2; 3731 } 3732 3733 return this; 3734 }, 3735 3736 events: function($el) { 3737 var self = this, 3738 previewParCurrentHeight = 0, 3739 previewParAnimateHeight = 0, 3740 toggleContent = null; 3741 3742 $el.find('> label').click(function(e) { 3743 3744 var $this = $(this), 3745 parentSection = $this.parent(), 3746 parentWrapper = $this.parents('.toggle'), 3747 previewPar = null, 3748 closeElement = null; 3749 3750 if (self.options.isAccordion && typeof(e.originalEvent) != 'undefined') { 3751 closeElement = parentWrapper.find('.toggle.active > label'); 3752 3753 if (closeElement[0] == $this[0]) { 3754 return; 3755 } 3756 } 3757 3758 parentSection.toggleClass('active'); 3759 3760 // Preview Paragraph 3761 if (parentSection.find('> p').get(0)) { 3762 3763 previewPar = parentSection.find('> p'); 3764 previewParCurrentHeight = previewPar.css('height'); 3765 previewPar.css('height', 'auto'); 3766 previewParAnimateHeight = previewPar.css('height'); 3767 previewPar.css('height', previewParCurrentHeight); 3768 3769 } 3770 3771 // Content 3772 toggleContent = parentSection.find('> .toggle-content'); 3773 3774 if (parentSection.hasClass('active')) { 3775 3776 $(previewPar).animate({ 3777 height: previewParAnimateHeight 3778 }, self.options.duration, function() { 3779 $(this).addClass('preview-active'); 3780 }); 3781 3782 toggleContent.slideDown(self.options.duration, function() { 3783 if (closeElement) { 3784 closeElement.trigger('click'); 3785 } 3786 }); 3787 3788 } else { 3789 3790 $(previewPar).animate({ 3791 height: 0 3792 }, self.options.duration, function() { 3793 $(this).removeClass('preview-active'); 3794 }); 3795 3796 toggleContent.slideUp(self.options.duration); 3797 3798 } 3799 3800 }); 3801 } 3802 }; 3803 3804 // expose to scope 3805 $.extend(theme, { 3806 PluginToggle: PluginToggle 3807 }); 3808 3809 // jquery plugin 3810 $.fn.themePluginToggle = function(opts) { 3811 return this.map(function() { 3812 var $this = $(this); 3813 3814 if ($this.data(instanceName)) { 3815 return $this.data(instanceName); 3816 } else { 3817 return new PluginToggle($this, opts); 3818 } 3819 3820 }); 3821 } 3822 3823}).apply(this, [window.theme, jQuery]); 3824 3825// Tweets 3826(function(theme, $) { 3827 3828 theme = theme || {}; 3829 3830 var instanceName = '__tweets'; 3831 3832 var PluginTweets = function($el, opts) { 3833 return this.initialize($el, opts); 3834 }; 3835 3836 PluginTweets.defaults = { 3837 username: null, 3838 count: 2, 3839 URL: 'php/twitter-feed.php', 3840 iconColor: false 3841 }; 3842 3843 PluginTweets.prototype = { 3844 initialize: function($el, opts) { 3845 if ($el.data(instanceName)) { 3846 return this; 3847 } 3848 3849 this.$el = $el; 3850 3851 this 3852 .setData() 3853 .setOptions(opts) 3854 .build(); 3855 3856 return this; 3857 }, 3858 3859 setData: function() { 3860 this.$el.data(instanceName, this); 3861 3862 return this; 3863 }, 3864 3865 setOptions: function(opts) { 3866 this.options = $.extend(true, {}, PluginTweets.defaults, opts, { 3867 wrapper: this.$el 3868 }); 3869 3870 return this; 3871 }, 3872 3873 build: function() { 3874 if (this.options.username == null || this.options.username == '') { 3875 return this; 3876 } 3877 3878 var self = this, 3879 $wrapper = this.options.wrapper; 3880 3881 $.ajax({ 3882 type: 'GET', 3883 data: { 3884 twitter_screen_name: self.options.username, 3885 tweets_to_display: self.options.count, 3886 icon_color: self.options.iconColor 3887 }, 3888 url: self.options.URL, 3889 }).done(function(html) { 3890 $wrapper.html(html).find('a').attr('target','_blank'); 3891 }); 3892 3893 return this; 3894 } 3895 }; 3896 3897 // expose to scope 3898 $.extend(theme, { 3899 PluginTweets: PluginTweets 3900 }); 3901 3902 // jquery plugin 3903 $.fn.themePluginTweets = function(opts) { 3904 return this.map(function() { 3905 var $this = $(this); 3906 3907 if ($this.data(instanceName)) { 3908 return $this.data(instanceName); 3909 } else { 3910 return new PluginTweets($this, opts); 3911 } 3912 3913 }); 3914 } 3915 3916}).apply(this, [window.theme, jQuery]); 3917 3918// Validation 3919(function(theme, $) { 3920 3921 theme = theme || {}; 3922 3923 $.extend(theme, { 3924 3925 PluginValidation: { 3926 3927 defaults: { 3928 formClass: 'needs-validation', 3929 validator: { 3930 highlight: function(element) { 3931 $(element) 3932 .addClass('is-invalid') 3933 .removeClass('is-valid') 3934 .parent() 3935 .removeClass('has-success') 3936 .addClass('has-danger'); 3937 }, 3938 success: function(label, element) { 3939 $(element) 3940 .removeClass('is-invalid') 3941 .addClass('is-valid') 3942 .parent() 3943 .removeClass('has-danger') 3944 .addClass('has-success') 3945 .find('label.error') 3946 .remove(); 3947 }, 3948 errorPlacement: function(error, element) { 3949 if (element.attr('type') == 'radio' || element.attr('type') == 'checkbox') { 3950 error.appendTo(element.parent().parent()); 3951 } else { 3952 error.insertAfter(element); 3953 } 3954 } 3955 }, 3956 validateCaptchaURL: 'php/contact-form-verify-captcha.php', 3957 refreshCaptchaURL: 'php/contact-form-refresh-captcha.php' 3958 }, 3959 3960 initialize: function(opts) { 3961 initialized = true; 3962 3963 this 3964 .setOptions(opts) 3965 .build(); 3966 3967 return this; 3968 }, 3969 3970 setOptions: function(opts) { 3971 this.options = $.extend(true, {}, this.defaults, opts); 3972 3973 return this; 3974 }, 3975 3976 build: function() { 3977 var self = this; 3978 3979 if (!($.isFunction($.validator))) { 3980 return this; 3981 } 3982 3983 self.addMethods(); 3984 self.setMessageGroups(); 3985 3986 $.validator.setDefaults(self.options.validator); 3987
3988 $('.' + self.options.formClass).validate(); 3989 3990 return this; 3991 }, 3992 3993 addMethods: function() { 3994 var self = this; 3995 3996 $.validator.addMethod('captcha', function(value, element, params) { 3997 var captchaValid = false; 3998 3999 $.ajax({ 4000 url: self.options.validateCaptchaURL, 4001 type: 'POST', 4002 async: false, 4003 dataType: 'json', 4004 data: { 4005 captcha: $.trim(value) 4006 }, 4007 success: function(data) { 4008 if (data.response == 'success') { 4009 captchaValid = true; 4010 } 4011 } 4012 }); 4013 4014 if (captchaValid) { 4015 return true; 4016 } 4017 4018 }, ''); 4019 4020 // Refresh Captcha 4021 $('#refreshCaptcha').on('click', function(e) { 4022 e.preventDefault(); 4023 $.get(self.options.refreshCaptchaURL, function(url) { 4024 $('#captcha-image').attr('src', url); 4025 }); 4026 }); 4027 4028 }, 4029 4030 setMessageGroups: function() { 4031 4032 $('.checkbox-group[data-msg-required], .radio-group[data-msg-required]').each(function() { 4033 var message = $(this).data('msg-required'); 4034 $(this).find('input').attr('data-msg-required', message); 4035 }); 4036 4037 } 4038 4039 } 4040 4041 }); 4042 4043}).apply(this, [window.theme, jQuery]); 4044 4045// Video Background 4046(function(theme, $) { 4047 4048 theme = theme || {}; 4049 4050 var instanceName = '__videobackground'; 4051 4052 var PluginVideoBackground = function($el, opts) { 4053 return this.initialize($el, opts); 4054 }; 4055 4056 PluginVideoBackground.defaults = { 4057 overlay: false, 4058 volume: 1, 4059 playbackRate: 1, 4060 muted: true, 4061 loop: true, 4062 autoplay: true, 4063 position: '50% 50%', 4064 posterType: 'detect' 4065 }; 4066 4067 PluginVideoBackground.prototype = { 4068 initialize: function($el, opts) { 4069 this.$el = $el; 4070 4071 this 4072 .setData() 4073 .setOptions(opts) 4074 .build(); 4075 4076 return this; 4077 }, 4078 4079 setData: function() { 4080 this.$el.data(instanceName, this); 4081 4082 return this; 4083 }, 4084 4085 setOptions: function(opts) { 4086 this.options = $.extend(true, {}, PluginVideoBackground.defaults, opts, { 4087 path: this.$el.data('video-path'), 4088 wrapper: this.$el 4089 }); 4090 4091 return this; 4092 }, 4093 4094 build: function() { 4095 4096 if (!($.isFunction($.fn.vide)) || (!this.options.path)) { 4097 return this; 4098 } 4099 4100 if (this.options.overlay) { 4101 4102 var overlayClass = this.options.overlayClass; 4103 4104 this.options.wrapper.prepend( 4105 $('<div />').addClass(overlayClass) 4106 ); 4107 } 4108 4109 this.options.wrapper 4110 .vide(this.options.path, this.options) 4111 .first().css('z-index', 0); 4112 4113 return this; 4114 } 4115 }; 4116 4117 // expose to scope 4118 $.extend(theme, { 4119 PluginVideoBackground: PluginVideoBackground 4120 }); 4121 4122 // jquery plugin 4123 $.fn.themePluginVideoBackground = function(opts) { 4124 return this.map(function() { 4125 var $this = $(this); 4126 4127 if ($this.data(instanceName)) { 4128 return $this.data(instanceName); 4129 } else { 4130 return new PluginVideoBackground($this, opts); 4131 } 4132 4133 }); 4134 } 4135 4136}).apply(this, [window.theme, jQuery]); 4137 4138// Account 4139(function(theme, $) { 4140 4141 theme = theme || {}; 4142 4143 var initialized = false; 4144 4145 $.extend(theme, { 4146 4147 Account: { 4148 4149 defaults: { 4150 wrapper: $('#headerAccount') 4151 }, 4152 4153 initialize: function($wrapper, opts) { 4154 if (initialized) { 4155 return this; 4156 } 4157 4158 initialized = true; 4159 this.$wrapper = ($wrapper || this.defaults.wrapper); 4160 4161 this 4162 .setOptions(opts) 4163 .events(); 4164 4165 return this; 4166 }, 4167 4168 setOptions: function(opts) { 4169 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 4170 4171 return this; 4172 }, 4173 4174 events: function() { 4175 var self = this; 4176 4177 $(window).on('load', function(){ 4178 $(document).ready(function(){ 4179 setTimeout(function(){ 4180 4181 self.$wrapper.find('input').on('focus', function() { 4182 self.$wrapper.addClass('open'); 4183 4184 $(document).mouseup(function(e) { 4185 if (!self.$wrapper.is(e.target) && self.$wrapper.has(e.target).length === 0) { 4186 self.$wrapper.removeClass('open'); 4187 } 4188 }); 4189 }); 4190 4191 }, 1500); 4192 }); 4193 }); 4194 4195 $('#headerSignUp').on('click', function(e) { 4196 e.preventDefault(); 4197 self.$wrapper.addClass('signup').removeClass('signin').removeClass('recover'); 4198 self.$wrapper.find('.signup-form input:first').focus(); 4199 }); 4200 4201 $('#headerSignIn').on('click', function(e) { 4202 e.preventDefault(); 4203 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover'); 4204 self.$wrapper.find('.signin-form input:first').focus(); 4205 }); 4206 4207 $('#headerRecover').on('click', function(e) { 4208 e.preventDefault(); 4209 self.$wrapper.addClass('recover').removeClass('signup').removeClass('signin'); 4210 self.$wrapper.find('.recover-form input:first').focus(); 4211 }); 4212 4213 $('#headerRecoverCancel').on('click', function(e) { 4214 e.preventDefault(); 4215 self.$wrapper.addClass('signin').removeClass('signup').removeClass('recover'); 4216 self.$wrapper.find('.signin-form input:first').focus(); 4217 }); 4218 } 4219 4220 } 4221 4222 }); 4223 4224}).apply(this, [window.theme, jQuery]); 4225 4226// Nav 4227(function(theme, $) { 4228 4229 theme = theme || {}; 4230 4231 var initialized = false;
4232 4233 $.extend(theme, { 4234 4235 Nav: { 4236 4237 defaults: { 4238 wrapper: $('#mainNav'), 4239 scrollDelay: 600, 4240 scrollAnimation: 'easeOutQuad' 4241 }, 4242 4243 initialize: function($wrapper, opts) { 4244 if (initialized) { 4245 return this; 4246 } 4247 4248 initialized = true; 4249 this.$wrapper = ($wrapper || this.defaults.wrapper); 4250 4251 this 4252 .setOptions(opts) 4253 .build() 4254 .events(); 4255 4256 return this; 4257 }, 4258 4259 setOptions: function(opts) { 4260 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 4261 4262 return this; 4263 }, 4264 4265 build: function() { 4266 var self = this, 4267 $html = $('html'), 4268 $header = $('#header'), 4269 $headerNavMain = $('#header .header-nav-main'), 4270 thumbInfoPreview; 4271 4272 // Preview Thumbs 4273 self.$wrapper.find('a[data-thumb-preview]').each(function() { 4274 thumbInfoPreview = $('<span />').addClass('thumb-info thumb-info-preview') 4275 .append($('<span />').addClass('thumb-info-wrapper') 4276 .append($('<span />').addClass('thumb-info-image').css('background-image', 'url(' + $(this).data('thumb-preview') + ')') 4277 ) 4278 ); 4279 4280 $(this).append(thumbInfoPreview); 4281 }); 4282 4283 // Side Header / Side Header Hamburguer Sidebar (Reverse Dropdown) 4284 if($html.hasClass('side-header') || $html.hasClass('side-header-hamburguer-sidebar')) { 4285 4286 // Side Header Right / Side Header Hamburguer Sidebar Right 4287 if($html.hasClass('side-header-right') || $html.hasClass('side-header-hamburguer-sidebar-right')) { 4288 if(!$html.hasClass('side-header-right-no-reverse')) { 4289 $header.find('.dropdown-submenu').addClass('dropdown-reverse'); 4290 } 4291 } 4292 4293 } else { 4294 4295 // Reverse 4296 self.checkReverse = function() { 4297 self.$wrapper.find('.dropdown, .dropdown-submenu').removeClass('dropdown-reverse'); 4298 4299 self.$wrapper.find('.dropdown:not(.manual):not(.dropdown-mega), .dropdown-submenu:not(.manual)').each(function() { 4300 if(!$(this).find('.dropdown-menu').visible( false, true, 'horizontal' ) ) { 4301 $(this).addClass('dropdown-reverse'); 4302 } 4303 }); 4304 } 4305 4306 self.checkReverse(); 4307 4308 $(window).on('resize', function() { 4309 self.checkReverse(); 4310 }); 4311 4312 } 4313 4314 // Clone Items 4315 if($headerNavMain.hasClass('header-nav-main-clone-items')) { 4316 4317 $headerNavMain.find('nav > ul > li > a').each(function(){ 4318 var parent = $(this).parent(), 4319 clone = $(this).clone(), 4320 clone2 = $(this).clone(), 4321 wrapper = $('<span class="wrapper-items-cloned"></span>'); 4322 4323 // Config Classes 4324 $(this).addClass('item-original'); 4325 clone2.addClass('item-two'); 4326 4327 // Insert on DOM 4328 parent.prepend(wrapper); 4329 wrapper.append(clone).append(clone2); 4330 }); 4331 4332 } 4333 4334 // Floating 4335 if($('#header.header-floating-icons').get(0) && $(window).width() > 991) { 4336 4337 var menuFloatingAnim = { 4338 $menuFloating: $('#header.header-floating-icons .header-container > .header-row'), 4339 4340 build: function() { 4341 var self = this; 4342 4343 self.init(); 4344 }, 4345 init: function(){ 4346 var self = this, 4347 divisor = 0; 4348 4349 $(window).scroll(function() { 4350 var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height()), 4351 st = $(this).scrollTop(); 4352 4353 divisor = $(document).height() / $(window).height(); 4354 4355 self.$menuFloating.find('.header-column > .header-row').css({ 4356 transform : 'translateY( calc('+ scrollPercent +'vh - '+ st / divisor +'px) )' 4357 }); 4358 }); 4359 } 4360 } 4361 4362 menuFloatingAnim.build(); 4363 4364 } 4365 4366 // Slide 4367 if($('.header-nav-links-vertical-slide').get(0)) { 4368 var slideNavigation = { 4369 $mainNav: $('#mainNav'), 4370 $mainNavItem: $('#mainNav li'), 4371 4372 build: function(){ 4373 var self = this; 4374 4375 self.menuNav(); 4376 }, 4377 menuNav: function(){ 4378 var self = this; 4379 4380 self.$mainNavItem.on('click', function(e){ 4381 var currentMenuItem = $(this), 4382 currentMenu = $(this).parent(), 4383 nextMenu = $(this).find('ul').first(), 4384 prevMenu = $(this).closest('.next-menu'), 4385 isSubMenu = currentMenuItem.hasClass('dropdown') || currentMenuItem.hasClass('dropdown-submenu'), 4386 isBack = currentMenuItem.hasClass('back-button'), 4387 nextMenuHeightDiff = ( ( nextMenu.find('> li').length * nextMenu.find('> li').outerHeight() ) - nextMenu.outerHeight() ), 4388 prevMenuHeightDiff = ( ( prevMenu.find('> li').length * prevMenu.find('> li').outerHeight() ) - prevMenu.outerHeight() ); 4389 4390 if( isSubMenu ) { 4391 currentMenu.addClass('next-menu'); 4392 nextMenu.addClass('visible'); 4393 currentMenu.css({ 4394 overflow: 'visible', 4395 'overflow-y': 'visible' 4396 }); 4397 4398 if( nextMenuHeightDiff > 0 ) { 4399 nextMenu.css({ 4400 overflow: 'hidden', 4401 'overflow-y': 'scroll' 4402 }); 4403 } 4404 4405 for( i = 0; i < nextMenu.find('> li').length; i++ ) { 4406 if( nextMenu.outerHeight() < ($('.header-row-side-header').outerHeight() - 100) ) { 4407 nextMenu.css({ 4408 height: nextMenu.outerHeight() + nextMenu.find('> li').outerHeight() 4409 }); 4410 } 4411 } 4412 4413 nextMenu.css({ 4414 'padding-top': nextMenuHeightDiff + 'px' 4415 }); 4416 } 4417 4418 if( isBack ) { 4419 currentMenu.parent().parent().removeClass('next-menu'); 4420 currentMenu.removeClass('visible'); 4421 4422 if( prevMenuHeightDiff > 0 ) { 4423 prevMenu.css({ 4424 overflow: 'hidden', 4425 'overflow-y': 'scroll' 4426 }); 4427 } 4428 } 4429 4430 e.stopPropagation(); 4431 }); 4432 } 4433 } 4434 4435 $(window).trigger('resize'); 4436 4437 if( $(window).width() > 991 ) { 4438 slideNavigation.build(); 4439 } 4440 4441 $(document).ready(function(){ 4442 $(window).afterResize(function(){ 4443 if( $(window).width() > 991 ) { 4444 slideNavigation.build(); 4445 } 4446 }); 4447 }); 4448 } 4449 4450 // Header Nav Main Mobile Dark 4451 if($('.header-nav-main-mobile-dark').get(0)) { 4452 $('#header:not(.header-transparent-dark-bottom-border):not(.header-transparent-light-bottom-border)').addClass('header-no-border-bottom'); 4453 } 4454 4455 return this; 4456 }, 4457 4458 events: function() { 4459 var self = this, 4460 $html = $('html'), 4461 $header = $('#header'), 4462 $window = $(window), 4463 headerBodyHeight = $('.header-body').outerHeight(); 4464 4465 $header.find('a[href="#"]').on('click', function(e) { 4466 e.preventDefault(); 4467 }); 4468 4469 // Mobile Arrows 4470 $header.find('.dropdown-toggle, .dropdown-submenu > a') 4471 .append('<i class="fas fa-chevron-down"></i>'); 4472 4473 $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) { 4474 e.preventDefault(); 4475 if ($window.width() < 992) { 4476 $(this).closest('li').toggleClass('open'); 4477 4478 // Adjust Header Body Height 4479 var height = ( $header.hasClass('header-effect-shrink') && $html.hasClass('sticky-header-active') ) ? theme.StickyHeader.options.stickyHeaderContainerHeight : headerBodyHeight; 4480 $('.header-body').animate({ 4481 height: ($('.header-nav-main nav').outerHeight(true) + height) + 10 4482 }, 0); 4483 } 4484 }); 4485 4486 $header.find('li a.active').addClass('current-page-active'); 4487 4488 // Add Open Class 4489 $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) { 4490 e.preventDefault(); 4491 e.stopPropagation(); 4492 if ($window.width() > 991) { 4493 4494 $header.find('li a.active').removeClass('active'); 4495 4496 if( $(this).prop('tagName') == 'I' ) { 4497 $(this).parent().addClass('active'); 4498 } else { 4499 $(this).addClass('active'); 4500 } 4501 4502 if (!$(this).closest('li').hasClass('open')) { 4503 4504 var $li = $(this).closest('li'), 4505 isSub = false;
4506 4507 if ( $(this).parent().hasClass('dropdown-submenu') ) { 4508 isSub = true; 4509 } 4510 4511 $(this).closest('.dropdown-menu').find('.dropdown-submenu.open').removeClass('open'); 4512 $(this).parent('.dropdown').parent().find('.dropdown.open').removeClass('open'); 4513 4514 if (!isSub) { 4515 $(this).parent().find('.dropdown-submenu.open').removeClass('open'); 4516 } 4517 4518 $li.addClass('open'); 4519 4520 $(document).off('click.nav-click-to-open').on('click.nav-click-to-open', function (e) { 4521 if (!$li.is(e.target) && $li.has(e.target).length === 0) { 4522 $li.removeClass('open'); 4523 $li.parents('.open').removeClass('open'); 4524 $header.find('li a.active').removeClass('active'); 4525 $header.find('li a.current-page-active').addClass('active'); 4526 } 4527 }); 4528 4529 } else { 4530 $(this).closest('li').removeClass('open'); 4531 $header.find('li a.active').removeClass('active'); 4532 $header.find('li a.current-page-active').addClass('active'); 4533 } 4534 4535 $window.trigger({ 4536 type: 'resize', 4537 from: 'header-nav-click-to-open' 4538 }); 4539 } 4540 }); 4541 4542 // Collapse Nav 4543 $header.find('[data-collapse-nav]').on('click', function(e) { 4544 $(this).parents('.collapse').removeClass('show'); 4545 }); 4546 4547 // Top Features 4548 $header.find('.header-nav-features-toggle').on('click', function(e) { 4549 e.preventDefault(); 4550 4551 var $toggleParent = $(this).parent(); 4552 4553 if (!$(this).siblings('.header-nav-features-dropdown').hasClass('show')) { 4554 4555 var $dropdown = $(this).siblings('.header-nav-features-dropdown'); 4556 4557 $('.header-nav-features-dropdown.show').removeClass('show'); 4558 4559 $dropdown.addClass('show'); 4560 4561 $(document).off('click.header-nav-features-toggle').on('click.header-nav-features-toggle', function (e) { 4562 if (!$toggleParent.is(e.target) && $toggleParent.has(e.target).length === 0) { 4563 $('.header-nav-features-dropdown.show').removeClass('show'); 4564 } 4565 }); 4566 4567 if ($(this).attr('data-focus')) { 4568 $('#' + $(this).attr('data-focus')).focus(); 4569 } 4570 4571 } else { 4572 $(this).siblings('.header-nav-features-dropdown').removeClass('show'); 4573 } 4574 }); 4575 4576 // Hamburguer Menu 4577 var $hamburguerMenuBtn = $('.hamburguer-btn:not(.side-panel-toggle)'), 4578 $hamburguerSideHeader = $('#header.side-header, #header.side-header-overlay-full-screen'); 4579 4580 $hamburguerMenuBtn.on('click', function(){ 4581 if($(this).attr('data-set-active') != 'false') { 4582 $(this).toggleClass('active'); 4583 } 4584 $hamburguerSideHeader.toggleClass('side-header-hide'); 4585 $html.toggleClass('side-header-hide'); 4586 4587 $window.trigger('resize'); 4588 }); 4589 4590 $('.hamburguer-close:not(.side-panel-toggle)').on('click', function(){ 4591 $('.hamburguer-btn:not(.hamburguer-btn-side-header-mobile-show)').trigger('click'); 4592 }); 4593 4594 // Set Header Body Height when open mobile menu 4595 $('.header-nav-main nav').on('show.bs.collapse', function () { 4596 $(this).removeClass('closed'); 4597 4598 // Add Mobile Menu Opened Class 4599 $('html').addClass('mobile-menu-opened'); 4600 4601 $('.header-body').animate({ 4602 height: ($('.header-body').outerHeight() + $('.header-nav-main nav').outerHeight(true)) + 10 4603 }); 4604 4605 // Header Below Slider / Header Bottom Slider - Scroll to menu position 4606 if( $('#header').is('.header-bottom-slider, .header-below-slider') && !$('html').hasClass('sticky-header-active') ) { 4607 self.scrollToTarget( $('#header'), 0 ); 4608 } 4609 }); 4610 4611 // Set Header Body Height when collapse mobile menu 4612 $('.header-nav-main nav').on('hide.bs.collapse', function () { 4613 $(this).addClass('closed'); 4614 4615 // Remove Mobile Menu Opened Class 4616 $('html').removeClass('mobile-menu-opened'); 4617 4618 $('.header-body').animate({ 4619 height: ($('.header-body').outerHeight() - $('.header-nav-main nav').outerHeight(true)) 4620 }, function(){ 4621 $(this).height('auto'); 4622 }); 4623 }); 4624 4625 // Header Effect Shrink - Adjust header body height on mobile 4626 $window.on('stickyHeader.activate', function(){ 4627 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) { 4628 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) { 4629 $('.header-body').animate({ 4630 height: ( $('.header-nav-main nav').outerHeight(true) + theme.StickyHeader.options.stickyHeaderContainerHeight ) + ( ($('.header-nav-bar').get(0)) ? $('.header-nav-bar').outerHeight() : 0 ) 4631 }); 4632 } 4633 } 4634 }); 4635 4636 $window.on('stickyHeader.deactivate', function(){ 4637 if( $window.width() < 992 && $header.hasClass('header-effect-shrink') ) { 4638 if( $('.header-btn-collapse-nav').attr('aria-expanded') == 'true' ) { 4639 $('.header-body').animate({ 4640 height: headerBodyHeight + $('.header-nav-main nav').outerHeight(true) + 10 4641 }); 4642 } 4643 } 4644 }); 4645 4646 // Remove Open Class on Resize 4647 $window.on('resize.removeOpen', function(e) { 4648 if( e.from == 'header-nav-click-to-open' ) { 4649 return; 4650 } 4651 4652 setTimeout(function() { 4653 if( $window.width() > 991 ) { 4654 $header.find('.dropdown.open').removeClass('open'); 4655 } 4656 }, 100); 4657 }); 4658 4659 // Side Header - Change value of initial header body height 4660 $(document).ready(function(){ 4661 if( $window.width() > 991 ) { 4662 var flag = false;
4663 4664 $window.on('resize', function(e) { 4665 if( e.from == 'header-nav-click-to-open' ) { 4666 return; 4667 } 4668 4669 $header.find('.dropdown.open').removeClass('open'); 4670 4671 if( $window.width() < 992 && flag == false ) { 4672 headerBodyHeight = $('.header-body').outerHeight(); 4673 flag = true; 4674 4675 setTimeout(function(){ 4676 flag = false; 4677 }, 500); 4678 } 4679 }); 4680 } 4681 }); 4682 4683 // Side Header - Set header height on mobile 4684 if( $html.hasClass('side-header') ) { 4685 if( $window.width() < 992 ) { 4686 $header.css({ 4687 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') )) 4688 }); 4689 } 4690 4691 $(document).ready(function(){ 4692 $window.afterResize(function(){ 4693 if( $window.width() < 992 ) { 4694 $header.css({ 4695 height: $('.header-body .header-container').outerHeight() + (parseInt( $('.header-body').css('border-top-width') ) + parseInt( $('.header-body').css('border-bottom-width') )) 4696 }); 4697 } else { 4698 $header.css({ 4699 height: '' 4700 }); 4701 } 4702 }); 4703 }); 4704 } 4705 4706 // Anchors Position 4707 $('[data-hash]').each(function() { 4708 4709 var target = $(this).attr('href'), 4710 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0); 4711 4712 if($(target).get(0)) { 4713 $(this).on('click', function(e) { 4714 e.preventDefault(); 4715 4716 if( !$(e.target).is('i') ) { 4717 4718 // Close Collapse if open 4719 $(this).parents('.collapse.show').collapse('hide'); 4720 4721 // Close Side Header 4722 $hamburguerSideHeader.addClass('side-header-hide'); 4723 $html.addClass('side-header-hide'); 4724 4725 $window.trigger('resize'); 4726 4727 self.scrollToTarget(target, offset); 4728 4729 } 4730 4731 return; 4732 }); 4733 } 4734 4735 }); 4736 4737 // Floating 4738 if($('#header.header-floating-icons').get(0)) { 4739 4740 $('#header.header-floating-icons [data-hash]').off().each(function() { 4741 4742 var target = $(this).attr('href'), 4743 offset = ($(this).is("[data-hash-offset]") ? $(this).data('hash-offset') : 0); 4744 4745 if($(target).get(0)) { 4746 $(this).on('click', function(e) { 4747 e.preventDefault(); 4748 4749 $('html, body').animate({ 4750 scrollTop: $(target).offset().top - offset 4751 }, 600, 'easeOutQuad', function() { 4752 4753 }); 4754 4755 return; 4756 }); 4757 } 4758 4759 }); 4760 4761 } 4762 4763 // Side Panel Toggle 4764 if( $('.side-panel-toggle').get(0) ) { 4765 var init_html_class = $('html').attr('class'); 4766 4767 $('.side-panel-toggle').on('click', function(e){ 4768 var extra_class = $(this).data('extra-class'), 4769 delay = ( extra_class ) ? 100 : 0; 4770 4771 e.preventDefault(); 4772 4773 if( $(this).hasClass('active') ) { 4774 $('html').removeClass('side-panel-open'); 4775 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active'); 4776 return false; 4777 } 4778 4779 if( extra_class ) { 4780 $('.side-panel-wrapper').css('transition','none'); 4781 $('html') 4782 .removeClass() 4783 .addClass( init_html_class ) 4784 .addClass( extra_class ); 4785 } 4786 4787 setTimeout(function(){ 4788 $('.side-panel-wrapper').css('transition',''); 4789 $('html').toggleClass('side-panel-open'); 4790 }, delay); 4791 }); 4792 4793 $(document).on('click', function(e){ 4794 if( !$(e.target).closest('.side-panel-wrapper').get(0) && !$(e.target).hasClass('side-panel-toggle') ) { 4795 $('.hamburguer-btn.side-panel-toggle:not(.side-panel-close)').removeClass('active'); 4796 $('html').removeClass('side-panel-open'); 4797 } 4798 }); 4799 } 4800 4801 return this; 4802 }, 4803 4804 scrollToTarget: function(target, offset) { 4805 var self = this; 4806 4807 $('body').addClass('scrolling'); 4808 4809 $('html, body').animate({ 4810 scrollTop: $(target).offset().top - offset 4811 }, self.options.scrollDelay, self.options.scrollAnimation, function() { 4812 $('body').removeClass('scrolling'); 4813 }); 4814 4815 return this; 4816 4817 } 4818 4819 } 4820 4821 }); 4822 4823}).apply(this, [window.theme, jQuery]); 4824 4825 4826// Newsletter 4827(function(theme, $) { 4828 4829 theme = theme || {}; 4830 4831 var initialized = false;
4832 4833 $.extend(theme, { 4834 4835 Newsletter: { 4836 4837 defaults: { 4838 wrapper: $('#newsletterForm') 4839 }, 4840 4841 initialize: function($wrapper, opts) { 4842 if (initialized) { 4843 return this; 4844 } 4845 4846 initialized = true; 4847 this.$wrapper = ($wrapper || this.defaults.wrapper); 4848 4849 this 4850 .setOptions(opts) 4851 .build(); 4852 4853 return this; 4854 }, 4855 4856 setOptions: function(opts) { 4857 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 4858 4859 return this; 4860 }, 4861 4862 build: function() { 4863 if (!($.isFunction($.fn.validate))) { 4864 return this; 4865 } 4866 4867 var self = this, 4868 $email = self.$wrapper.find('#newsletterEmail'), 4869 $success = $('#newsletterSuccess'), 4870 $error = $('#newsletterError'); 4871 4872 self.$wrapper.validate({ 4873 submitHandler: function(form) { 4874 4875 $.ajax({ 4876 type: 'POST', 4877 url: self.$wrapper.attr('action'), 4878 data: { 4879 'email': $email.val() 4880 }, 4881 dataType: 'json', 4882 success: function(data) { 4883 if (data.response == 'success') { 4884 4885 $success.removeClass('d-none'); 4886 $error.addClass('d-none'); 4887 4888 $email 4889 .val('') 4890 .blur() 4891 .closest('.control-group') 4892 .removeClass('success') 4893 .removeClass('error'); 4894 4895 } else { 4896 4897 $error.html(data.message); 4898 $error.removeClass('d-none'); 4899 $success.addClass('d-none'); 4900 4901 $email 4902 .blur() 4903 .closest('.control-group') 4904 .removeClass('success') 4905 .addClass('error'); 4906 4907 } 4908 } 4909 }); 4910 4911 }, 4912 rules: { 4913 newsletterEmail: { 4914 required: true, 4915 email: true 4916 } 4917 }, 4918 errorPlacement: function(error, element) { 4919 4920 } 4921 }); 4922 4923 return this; 4924 } 4925 4926 } 4927 4928 }); 4929 4930}).apply(this, [window.theme, jQuery]); 4931 4932// Search 4933(function(theme, $) { 4934 4935 theme = theme || {}; 4936 4937 var initialized = false; 4938 4939 $.extend(theme, { 4940 4941 Search: { 4942 4943 defaults: { 4944 wrapper: $('#searchForm') 4945 }, 4946 4947 initialize: function($wrapper, opts) { 4948 if (initialized) { 4949 return this; 4950 } 4951 4952 initialized = true; 4953 this.$wrapper = ($wrapper || this.defaults.wrapper); 4954 4955 this 4956 .setOptions(opts) 4957 .build(); 4958 4959 return this; 4960 }, 4961 4962 setOptions: function(opts) { 4963 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 4964 4965 return this; 4966 }, 4967 4968 build: function() { 4969 if (!($.isFunction($.fn.validate))) { 4970 return this; 4971 } 4972 4973 this.$wrapper.validate({ 4974 errorPlacement: function(error, element) {} 4975 }); 4976 4977 // Search Reveal 4978 $('.header-nav-features-search-reveal').each(function() { 4979 4980 var $el = $(this) 4981 $header = $('#header'), 4982 $html = $('htmnl'); 4983 4984 $el.find('.header-nav-features-search-show-icon').on('click', function() { 4985 $el.addClass('show'); 4986 $header.addClass('search-show'); 4987 $html.addClass('search-show'); 4988 $('#headerSearch').focus(); 4989 }); 4990 4991 $el.find('.header-nav-features-search-hide-icon').on('click', function() { 4992 $el.removeClass('show'); 4993 $header.removeClass('search-show'); 4994 $html.removeClass('search-show'); 4995 }); 4996 4997 }); 4998 4999 return this; 5000 } 5001 5002 } 5003 5004 }); 5005 5006}).apply(this, [window.theme, jQuery]); 5007 5008// Sticky Header 5009(function(theme, $) { 5010 5011 theme = theme || {}; 5012 5013 var initialized = false; 5014 5015 $.extend(theme, { 5016 5017 StickyHeader: { 5018 5019 defaults: { 5020 wrapper: $('#header'), 5021 headerBody: $('#header .header-body'), 5022 stickyEnabled: true, 5023 stickyEnableOnBoxed: true, 5024 stickyEnableOnMobile: true, 5025 stickyStartAt: 0, 5026 stickyStartAtElement: false, 5027 stickySetTop: 0, 5028 stickyEffect: '', 5029 stickyHeaderContainerHeight: false, 5030 stickyChangeLogo: false, 5031 stickyChangeLogoWrapper: true 5032 }, 5033 5034 initialize: function($wrapper, opts) { 5035 if (initialized) { 5036 return this; 5037 } 5038 5039 initialized = true; 5040 this.$wrapper = ($wrapper || this.defaults.wrapper); 5041 5042 this 5043 .setOptions(opts) 5044 .build() 5045 .events(); 5046 5047 return this; 5048 }, 5049 5050 setOptions: function(opts) { 5051 this.options = $.extend(true, {}, this.defaults, opts, theme.fn.getOptions(this.$wrapper.data('plugin-options'))); 5052 5053 return this; 5054 }, 5055 5056 build: function() { 5057 if (!this.options.stickyEnableOnBoxed && $('html').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') || !this.options.stickyEnabled) { 5058 return this; 5059 } 5060 5061 var self = this, 5062 $html = $('html'), 5063 $window = $(window), 5064 sideHeader = $html.hasClass('side-header'), 5065 initialHeaderTopHeight = self.options.wrapper.find('.header-top').outerHeight(), 5066 initialHeaderContainerHeight = self.options.wrapper.find('.header-container').outerHeight(), 5067 minHeight; 5068 5069 // HTML Classes 5070 $html.addClass('sticky-header-enabled'); 5071 5072 if (parseInt(self.options.stickySetTop) < 0) { 5073 $html.addClass('sticky-header-negative'); 5074 } 5075 5076 // Set Start At 5077 if(self.options.stickyStartAtElement) { 5078 5079 var $stickyStartAtElement = $(self.options.stickyStartAtElement); 5080 5081 $(window).on('scroll resize', function() { 5082 self.options.stickyStartAt = $stickyStartAtElement.offset().top; 5083 }); 5084 5085 $(window).trigger('resize'); 5086 } 5087 5088 // Define Min Height value 5089 if( self.options.wrapper.find('.header-top').get(0) ) { 5090 minHeight = ( initialHeaderTopHeight + initialHeaderContainerHeight ); 5091 } else { 5092 minHeight = initialHeaderContainerHeight; 5093 } 5094 5095 // Set Wrapper Min-Height 5096 if( !sideHeader ) { 5097 if( !$('.header-logo-sticky-change').get(0) ) { 5098 self.options.wrapper.css('height', self.options.headerBody.outerHeight()); 5099 } else { 5100 $window.on('stickyChangeLogo.loaded', function(){ 5101 self.options.wrapper.css('height', self.options.headerBody.outerHeight()); 5102 }); 5103 } 5104 5105 if( self.options.stickyEffect == 'shrink' ) { 5106 5107 // Prevent wrong visualization of header when reload on middle of page 5108 $(document).ready(function(){ 5109 if( $window.scrollTop() >= self.options.stickyStartAt ) { 5110 self.options.wrapper.find('.header-container').on('transitionend webkitTransitionEnd oTransitionEnd', function(){ 5111 self.options.headerBody.css('position', 'fixed'); 5112 }); 5113 } else { 5114 self.options.headerBody.css('position', 'fixed'); 5115 } 5116 }); 5117 5118 self.options.wrapper.find('.header-container').css('height', initialHeaderContainerHeight); 5119 self.options.wrapper.find('.header-top').css('height', initialHeaderTopHeight); 5120 } 5121 } 5122 5123 // Sticky Header Container Height 5124 if( self.options.stickyHeaderContainerHeight ) { 5125 self.options.wrapper.find('.header-container').css('height', self.options.wrapper.find('.header-container').outerHeight()); 5126 } 5127 5128 // Boxed 5129 if($html.hasClass('boxed') && self.options.stickyEffect == 'shrink') { 5130 if( (parseInt(self.options.stickyStartAt) == 0) && $window.width() > 991) { 5131 self.options.stickyStartAt = 30; 5132 } 5133 5134 // Set Header Body Position Absolute 5135 self.options.headerBody.css('position','absolute'); 5136 5137 // Set position absolute because top margin from boxed layout 5138 $window.on('scroll', function(){ 5139 if( $window.scrollTop() > $('.body').offset().top ) { 5140 self.options.headerBody.css({ 5141 'position' : 'fixed', 5142 'top' : 0 5143 }); 5144 } else { 5145 self.options.headerBody.css({ 5146 'position' : 'absolute', 5147 'top' : 0 5148 }); 5149 } 5150 }); 5151 } 5152 5153 // Check Sticky Header / Flags prevent multiple runs at same time 5154 var activate_flag = true, 5155 deactivate_flag = false;
5156 5157 self.checkStickyHeader = function() { 5158 if( $window.width() > 991 && $html.hasClass('side-header') ) { 5159 $html.removeClass('sticky-header-active'); 5160 activate_flag = true; 5161 return; 5162 } 5163 5164 if ($window.scrollTop() >= parseInt(self.options.stickyStartAt)) { 5165 if( activate_flag ) { 5166 self.activateStickyHeader(); 5167 activate_flag = false; 5168 deactivate_flag = true; 5169 } 5170 } else { 5171 if( deactivate_flag ) { 5172 self.deactivateStickyHeader(); 5173 deactivate_flag = false; 5174 activate_flag = true; 5175 } 5176 } 5177 }; 5178 5179 // Activate Sticky Header 5180 self.activateStickyHeader = function() { 5181 5182 if ($window.width() < 992) { 5183 if (!self.options.stickyEnableOnMobile) { 5184 self.deactivateStickyHeader(); 5185 return; 5186 } 5187 } else { 5188 if (sideHeader) { 5189 self.deactivateStickyHeader(); 5190 return; 5191 } 5192 } 5193 5194 $html.addClass('sticky-header-active'); 5195 5196 // Sticky Effect - Reveal 5197 if( self.options.stickyEffect == 'reveal' ) { 5198 5199 self.options.headerBody.css('top','-' + self.options.stickyStartAt + 'px'); 5200 5201 self.options.headerBody.animate({ 5202 top: self.options.stickySetTop 5203 }, 400, function() {}); 5204 5205 } 5206 5207 // Sticky Effect - Shrink 5208 if( self.options.stickyEffect == 'shrink' ) { 5209 5210 // If Header Top 5211 if( self.options.wrapper.find('.header-top').get(0) ) { 5212 self.options.wrapper.find('.header-top').css({ 5213 height: 0, 5214 'min-height': 0, 5215 overflow: 'hidden' 5216 }); 5217 } 5218 5219 // Header Container 5220 if( self.options.stickyHeaderContainerHeight ) { 5221 self.options.wrapper.find('.header-container').css({ 5222 height: self.options.stickyHeaderContainerHeight, 5223 'min-height': 0 5224 }); 5225 } else { 5226 self.options.wrapper.find('.header-container').css({ 5227 height: (initialHeaderContainerHeight / 3) * 2, // two third of container height 5228 'min-height': 0 5229 }); 5230 5231 var y = initialHeaderContainerHeight - ((initialHeaderContainerHeight / 3) * 2); 5232 $('.main').css({ 5233 transform: 'translate3d(0, -'+ y +'px, 0)', 5234 transition: 'ease transform 300ms' 5235 }); 5236 5237 if($html.hasClass('boxed')) { 5238 self.options.headerBody.css('position','fixed'); 5239 } 5240 } 5241 5242 } 5243 5244 self.options.headerBody.css('top', self.options.stickySetTop); 5245 5246 if (self.options.stickyChangeLogo) { 5247 self.changeLogo(true); 5248 } 5249 5250 // Set Elements Style 5251 $('[data-sticky-header-style]').each(function() { 5252 var $el = $(this), 5253 css = theme.fn.getOptions($el.data('sticky-header-style-active')), 5254 opts = theme.fn.getOptions($el.data('sticky-header-style')); 5255 5256 if( $window.width() > opts.minResolution ) { 5257 $el.css(css); 5258 } 5259 }); 5260 5261 $.event.trigger({ 5262 type: 'stickyHeader.activate' 5263 }); 5264 }; 5265 5266 // Deactivate Sticky Header 5267 self.deactivateStickyHeader = function() { 5268 5269 $html.removeClass('sticky-header-active'); 5270 5271 // Sticky Effect - Shrink 5272 if( self.options.stickyEffect == 'shrink' ) { 5273 5274 // Boxed Layout 5275 if( $html.hasClass('boxed') ) { 5276 5277 // Set Header Body Position Absolute 5278 self.options.headerBody.css('position','absolute'); 5279 5280 if( $window.scrollTop() > $('.body').offset().top ) { 5281 // Set Header Body Position Fixed 5282 self.options.headerBody.css('position','fixed'); 5283 } 5284 5285 } else { 5286 // Set Header Body Position Fixed 5287 self.options.headerBody.css('position','fixed'); 5288 } 5289 5290 // If Header Top 5291 if( self.options.wrapper.find('.header-top').get(0) ) { 5292 self.options.wrapper.find('.header-top').css({ 5293 height: initialHeaderTopHeight, 5294 overflow: 'visible' 5295 }); 5296 } 5297 5298 // Header Container 5299 self.options.wrapper.find('.header-container').css({ 5300 height: initialHeaderContainerHeight 5301 }); 5302 5303 } 5304 5305 self.options.headerBody.css('top', 0); 5306 5307 if (self.options.stickyChangeLogo) { 5308 self.changeLogo(false); 5309 } 5310 5311 // Set Elements Style 5312 $('[data-sticky-header-style]').each(function() { 5313 var $el = $(this), 5314 css = theme.fn.getOptions($el.data('sticky-header-style-deactive')), 5315 opts = theme.fn.getOptions($el.data('sticky-header-style')); 5316 5317 if( $window.width() > opts.minResolution ) { 5318 $el.css(css); 5319 } 5320 }); 5321 5322 $.event.trigger({ 5323 type: 'stickyHeader.deactivate' 5324 }); 5325 }; 5326 5327 // Always Sticky 5328 if (parseInt(self.options.stickyStartAt) <= 0) { 5329 self.activateStickyHeader(); 5330 } 5331 5332 // Notice Top Bar 5333 if ($('.notice-top-bar').get(0)) { 5334 self.options.stickyStartAt = $('.notice-top-bar').outerHeight(); 5335 } 5336 5337 // Set Logo 5338 if (self.options.stickyChangeLogo) { 5339 5340 var $logoWrapper = self.options.wrapper.find('.header-logo'), 5341 $logo = $logoWrapper.find('img'), 5342 logoWidth = $logo.attr('width'), 5343 logoHeight = $logo.attr('height'), 5344 logoSmallTop = parseInt($logo.attr('data-sticky-top') ? $logo.attr('data-sticky-top') : 0), 5345 logoSmallWidth = parseInt($logo.attr('data-sticky-width') ? $logo.attr('data-sticky-width') : 'auto'),
5346 logoSmallHeight = parseInt($logo.attr('data-sticky-height') ? $logo.attr('data-sticky-height') : 'auto'); 5347 5348 if (self.options.stickyChangeLogoWrapper) { 5349 $logoWrapper.css({ 5350 'width': $logo.outerWidth(true), 5351 'height': $logo.outerHeight(true) 5352 }); 5353 } 5354 5355 self.changeLogo = function(activate) { 5356 if(activate) { 5357 5358 $logo.css({ 5359 'top': logoSmallTop, 5360 'width': logoSmallWidth, 5361 'height': logoSmallHeight 5362 }); 5363 5364 } else { 5365 5366 $logo.css({ 5367 'top': 0, 5368 'width': logoWidth, 5369 'height': logoHeight 5370 }); 5371 5372 } 5373 } 5374 5375 $.event.trigger({ 5376 type: 'stickyChangeLogo.loaded' 5377 }); 5378 5379 } 5380 5381 // Side Header 5382 var headerBodyHeight, 5383 flag = false; 5384 5385 self.checkSideHeader = function() { 5386 if($window.width() < 992 && flag == false) { 5387 headerBodyHeight = self.options.headerBody.height(); 5388 flag = true; 5389 } 5390 5391 if(self.options.stickyStartAt == 0 && sideHeader) { 5392 self.options.wrapper.css('min-height', 0); 5393 } 5394 5395 if(self.options.stickyStartAt > 0 && sideHeader && $window.width() < 992) { 5396 self.options.wrapper.css('min-height', headerBodyHeight); 5397 } 5398 } 5399 5400 return this; 5401 }, 5402 5403 events: function() { 5404 var self = this; 5405 5406 if (!this.options.stickyEnableOnBoxed && $('body').hasClass('boxed') || $('html').hasClass('side-header-hamburguer-sidebar') || !this.options.stickyEnabled) { 5407 return this; 5408 } 5409 5410 if (!self.options.alwaysStickyEnabled) { 5411 $(window).on('scroll resize', function() { 5412 self.checkStickyHeader(); 5413 }); 5414 } else { 5415 self.activateStickyHeader(); 5416 } 5417 5418 $(window).on('load resize', function(){ 5419 self.checkSideHeader(); 5420 }); 5421 5422 return this; 5423 } 5424 5425 } 5426 5427 }); 5428 5429}).apply(this, [window.theme, 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.