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