1(function($){ 2 "use strict"; 3 4 var $window = $(window); 5 6 $window.on('load', function() { 7 $window.trigger("resize"); 8 }); 9 10 // Preloader 11 $('.loader').fadeOut(); 12 $('.loader-mask').delay(350).fadeOut('slow'); 13 14 15 // Init 16 initOwlCarousel(); 17 setTimeout(function() { 18 initFlickity(); 19 }, 1000); 20 21 22 23 $window.on('resize', function() { 24 hideSidenav(); 25 megaMenu(); 26 }); 27 28 29 /* Detect Browser Size 30 -------------------------------------------------------*/ 31 var minWidth; 32 if (Modernizr.mq('(min-width: 0px)')) { 33 // Browsers that support media queries 34 minWidth = function (width) { 35 return Modernizr.mq('(min-width: ' + width + 'px)'); 36 }; 37 } 38 else { 39 // Fallback for browsers that does not support media queries 40 minWidth = function (width) { 41 return $window.width() >= width; 42 }; 43 } 44 45 46 /* Mobile Detect 47 -------------------------------------------------------*/ 48 if (/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent || navigator.vendor || window.opera)) { 49 $("html").addClass("mobile"); 50 $('.dropdown-toggle').attr('data-toggle', 'dropdown'); 51 } 52 else { 53 $("html").removeClass("mobile"); 54 } 55 56 /* IE Detect 57 -------------------------------------------------------*/ 58 if(Function('/*@cc_on return document.documentMode===10@*/')()){ $("html").addClass("ie"); } 59 60 61 /* Sticky Navigation 62 -------------------------------------------------------*/ 63 $window.scroll(function(){ 64 65 scrollToTop(); 66 var $stickyNav = $('.nav--sticky'); 67 68 if ($(window).scrollTop() > 190) { 69 $stickyNav.addClass('sticky'); 70 } else { 71 $stickyNav.removeClass('sticky'); 72 } 73 74 if ($(window).scrollTop() > 200) { 75 $stickyNav.addClass('offset'); 76 } else { 77 $stickyNav.removeClass('offset'); 78 } 79 80 if ($(window).scrollTop() > 500) { 81 $stickyNav.addClass('scrolling'); 82 } else { 83 $stickyNav.removeClass('scrolling'); 84 } 85 86 }); 87 88 89 /* Mobile Navigation 90 -------------------------------------------------------*/ 91 var $sidenav = $('#sidenav'), 92 $mainContainer = $('#main-container'), 93 $navIconToggle = $('.nav-icon-toggle'), 94 $navHolder = $('.nav__holder'), 95 $contentOverlay = $('.content-overlay'), 96 $htmlContainer = $('html'), 97 $sidenavCloseButton = $('#sidenav__close-button'); 98 99 100 $navIconToggle.on('click', function(e) { 101 e.stopPropagation(); 102 $(this).toggleClass('nav-icon-toggle--is-open'); 103 $sidenav.toggleClass('sidenav--is-open'); 104 $contentOverlay.toggleClass('content-overlay--is-visible'); 105 // $htmlContainer.toggleClass('oh'); 106 }); 107 108 function resetNav() { 109 $navIconToggle.removeClass('nav-icon-toggle--is-open'); 110 $sidenav.removeClass('sidenav--is-open'); 111 $contentOverlay.removeClass('content-overlay--is-visible'); 112 // $htmlContainer.removeClass('oh'); 113 } 114 115 function hideSidenav() { 116 if( minWidth(992) ) { 117 resetNav(); 118 setTimeout( megaMenu, 500 ); 119 } 120 } 121 122 $contentOverlay.on('click', function() { 123 resetNav(); 124 }); 125 126 $sidenavCloseButton.on('click', function() { 127 resetNav(); 128 }); 129 130 131 var $dropdownTrigger = $('.nav__dropdown-trigger'), 132 $navDropdownMenu = $('.nav__dropdown-menu'), 133 $navDropdown = $('.nav__dropdown'); 134 135 136 if ( $('html').hasClass('mobile') ) { 137 138 $('body').on('click',function() { 139 $navDropdownMenu.addClass('hide-dropdown'); 140 }); 141 142 $navDropdown.on('click', '> a', function(e) { 143 e.preventDefault(); 144 }); 145 146 $navDropdown.on('click',function(e) { 147 e.stopPropagation(); 148 $navDropdownMenu.removeClass('hide-dropdown'); 149 }); 150 } 151 152 153 /* Sidenav Menu 154 -------------------------------------------------------*/ 155 $('.sidenav__menu-toggle').on('click', function(e) { 156 e.preventDefault(); 157 158 var $this = $(this); 159 160 $this.parent().siblings().removeClass('sidenav__menu--is-open'); 161 $this.parent().siblings().find('li').removeClass('sidenav__menu--is-open'); 162 $this.parent().find('li').removeClass('sidenav__menu--is-open'); 163 $this.parent().toggleClass('sidenav__menu--is-open'); 164 165 if ($this.next().hasClass('show')) {
166 $this.next().removeClass('show').slideUp(350); 167 } else { 168 $this.parent().parent().find('li .sidenav__menu-dropdown').removeClass('show').slideUp(350); 169 $this.next().toggleClass('show').slideToggle(350); 170 } 171 }); 172 173 174 /* Nav Seacrh 175 -------------------------------------------------------*/ 176 (function() { 177 var navSearchTrigger = $('.nav__search-trigger'), 178 navSearchTriggerIcon = navSearchTrigger.find('i'), 179 navSearchBox = $('.nav__search-box'), 180 navSearchInput = $('.nav__search-input'); 181 182 navSearchTrigger.on('click', function(e){ 183 e.preventDefault(); 184 navSearchTriggerIcon.toggleClass('ui-close'); 185 navSearchBox.slideToggle(); 186 navSearchInput.focus(); 187 }); 188 })(); 189 190 191 /* Mega Menu 192 -------------------------------------------------------*/ 193 function megaMenu(){ 194 $('.nav__megamenu').each(function () { 195 var $this = $(this); 196 197 $this.css('width', $('.container').width()); 198 var offset = $this.closest('.nav__dropdown').offset(); 199 offset = offset.left; 200 var containerOffset = $(window).width() - $('.container').outerWidth(); 201 containerOffset = containerOffset /2; 202 offset = offset - containerOffset - 15; 203 $this.css('left', -offset); 204 }); 205 } 206 207 208 /* Twitter Feed 209 -------------------------------------------------------*/ 210 if($('#tweets').length) { 211 function initTwitter() { 212 var config1 = { 213 "id": '594366594521804800', 214 "domId": 'tweets', 215 "showUser": false, 216 "showInteraction": false, 217 "showPermalinks": false, 218 "showTime": true, 219 "maxTweets": 2, 220 "enableLinks": true 221 }; 222 twitterFetcher.fetch(config1); 223 } 224 initTwitter(); 225 } 226 227 228 /* YouTube Video Playlist 229 -------------------------------------------------------*/ 230 (function(){ 231 var videoPlaylistListItem = $('.video-playlist__list-item'), 232 videoPlaylistContentVideo = $('.video-playlist__content-video'); 233 234 videoPlaylistListItem.on('click', function(e){ 235 e.preventDefault(); 236 var $this = $(this); 237 var thumbVideoUrl = $this.attr('href'); 238 239 videoPlaylistContentVideo.attr('src', thumbVideoUrl); 240 241 $this.siblings().removeClass('video-playlist__list-item--active'); 242 $this.addClass('video-playlist__list-item--active'); 243 244 }); 245 246 })(); 247 248 249 250 /* News Ticker 251 -------------------------------------------------------*/ 252 var $newsTicker = $('.newsticker__list'); 253 254 if($newsTicker.length) { 255 $newsTicker.newsTicker({ 256 row_height: 34, 257 max_rows: 1, 258 prevButton: $('#newsticker-button--prev'), 259 nextButton: $('#newsticker-button--next') 260 }); 261 } 262 263 264 /* Tabs 265 -------------------------------------------------------*/ 266 $('.tabs__trigger').on('click', function(e) { 267 var currentAttrValue = $(this).attr('href'); 268 $('.tabs__content-trigger ' + currentAttrValue).stop().fadeIn(1000).siblings().hide(); 269 $(this).parent('li').addClass('tabs__item--active').siblings().removeClass('tabs__item--active'); 270 e.preventDefault(); 271 }); 272 273 274 /* Owl Carousel 275 -------------------------------------------------------*/ 276 function initOwlCarousel(){ 277 278 // Hero Slider 279 $("#owl-hero-slider").owlCarousel({ 280 center: true, 281 items: 1, 282 loop: true, 283 nav: true, 284 dots: false, 285 margin: 8, 286 lazyLoad: true, 287 navSpeed: 500, 288 navText: ['<i class="ui-arrow-left">','<i class="ui-arrow-right">'], 289 responsive:{ 290 1200: { 291 items:4 292 }, 293 768:{ 294 items:2 295 }, 296 540:{ 297 items:2 298 } 299 } 300 }); 301 302 // Posts Carousel 303 $("#owl-posts").owlCarousel({ 304 center: false, 305 items: 1, 306 loop: true, 307 nav: true, 308 dots: false, 309 margin: 30, 310 lazyLoad: true, 311 navSpeed: 500, 312 navText: ['<i class="ui-arrow-left">','<i class="ui-arrow-right">'], 313 responsive:{ 314 768:{ 315 items:4 316 }, 317 540:{ 318 items:3 319 } 320 } 321 });
322 323 // Related Posts 324 $("#owl-posts-3-items").owlCarousel({ 325 center: false, 326 items: 1, 327 loop: true, 328 nav: true, 329 dots: false, 330 margin: 20, 331 lazyLoad: true, 332 navSpeed: 500, 333 navText: ['<i class="ui-arrow-left">','<i class="ui-arrow-right">'], 334 responsive:{ 335 768:{ 336 items:3 337 }, 338 540:{ 339 items:2 340 } 341 } 342 }); 343 344 // Headlines 345 $("#owl-headlines").owlCarousel({ 346 items: 1, 347 loop: true, 348 nav: false, 349 dots: false, 350 lazyLoad: true, 351 navSpeed: 500, 352 navText: ['<i class="ui-arrow-left">','<i class="ui-arrow-right">'] 353 }); 354 355 // Single Image 356 $("#owl-single").owlCarousel({ 357 items: 1, 358 loop: true, 359 nav: true, 360 dots: false, 361 lazyLoad: true, 362 navSpeed: 500, 363 navText: ['<i class="ui-arrow-left">','<i class="ui-arrow-right">'] 364 }); 365 366 // Single Post Gallery 367 $("#owl-single-post-gallery").owlCarousel({ 368 items: 1, 369 loop: true, 370 nav: true, 371 dots: true, 372 lazyLoad: true, 373 navSpeed: 500, 374 navText: ['<i class="ui-arrow-left">','<i class="ui-arrow-right">'] 375 }); 376 377 // Custom nav 378 var owlCustomNav = $('#owl-headlines').owlCarousel(); 379 380 $(".owl-custom-nav__btn--prev").on('click', function () { 381 owlCustomNav.trigger('prev.owl.carousel'); 382 }); 383 384 $(".owl-custom-nav__btn--next").on('click', function () { 385 owlCustomNav.trigger('next.owl.carousel'); 386 }); 387 }; 388 389 390 /* Flickity Slider 391 -------------------------------------------------------*/ 392 function initFlickity() { 393 394 // 1st carousel, main 395 $('#flickity-hero').flickity({ 396 cellAlign: 'left', 397 contain: true, 398 pageDots: false, 399 prevNextButtons: false, 400 draggable: false 401 }); 402 403 // 2nd carousel, navigation 404 $('#flickity-thumbs').flickity({ 405 cellAlign: 'left', 406 asNavFor: '#flickity-hero', 407 contain: true, 408 pageDots: false, 409 prevNextButtons: false, 410 draggable: false 411 }); 412 } 413 414 415 /* Sticky Socials 416 -------------------------------------------------------*/ 417 (function() { 418 var $stickyCol = $('.sticky-col'); 419 if($stickyCol.length > 0) { 420 $stickyCol.stick_in_parent({ 421 offset_top: 80 422 }); 423 } 424 })(); 425 426 427 /* ---------------------------------------------------------------------- */ 428 /* Contact Form 429 /* ---------------------------------------------------------------------- */ 430 431 var submitContact = $('#submit-message'), 432 message = $('#msg'); 433 434 submitContact.on('click', function(e){ 435 e.preventDefault(); 436 437 var $this = $(this); 438 439 $.ajax({
440 type: "POST", 441 url: 'contact.php', 442 dataType: 'json', 443 cache: false, 444 data: $('#contact-form').serialize(), 445 success: function(data) { 446 447 if(data.info !== 'error'){ 448 $this.parents('form').find('input[type=text],input[type=email],textarea,select').filter(':visible').val(''); 449 message.hide().removeClass('success').removeClass('error').addClass('success').html(data.msg).fadeIn('slow').delay(5000).fadeOut('slow'); 450 } else { 451 message.hide().removeClass('success').removeClass('error').addClass('error').html(data.msg).fadeIn('slow').delay(5000).fadeOut('slow'); 452 } 453 } 454 }); 455 }); 456 457 /* Scroll to Top 458 -------------------------------------------------------*/ 459 function scrollToTop() { 460 var scroll = $window.scrollTop(); 461 var $backToTop = $("#back-to-top"); 462 if (scroll >= 50) { 463 $backToTop.addClass("show"); 464 } else { 465 $backToTop.removeClass("show"); 466 } 467 } 468 469 $('a[href="#top"]').on('click',function(){ 470 $('html, body').animate({scrollTop: 0}, 1000, "easeInOutQuint"); 471 return false; 472 }); 473 474})(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.