1// JavaScript Document 2 3$(window).on('load', function () { 4 'use strict'; 5 6 /*----------------------------------------------------*/ 7 /* Preloader 8 /*----------------------------------------------------*/ 9 10 $('#loader').delay(100).fadeOut(); 11 $('#loader-wrapper').delay(100).fadeOut('fast'); 12 13 // Some pages don't include the Stellar plugin; avoid runtime errors. 14 if ($.fn && typeof $.fn.stellar === 'function') { 15 $(window).stellar({}); 16 } 17}); 18 19$(window).on('scroll', function () { 20 'use strict'; 21 22 /*----------------------------------------------------*/ 23 /* Navigtion Menu Scroll 24 /*----------------------------------------------------*/ 25 26 var b = $(window).scrollTop(); 27 28 if (b > 72) { 29 $('.navbar').addClass('scroll'); 30 } else { 31 $('.navbar').removeClass('scroll'); 32 } 33}); 34 35/*----------------------------------------------------*/ 36/* Download links 37 /*----------------------------------------------------*/ 38// NOTE: Download links are now handled by `js/downloads.js` (vanilla JS), 39// so the release version is defined in one place. 40 41$(document).ready(function () { 42 'use strict'; 43 // (download links now initialized by downloads.js) 44 45 /*----------------------------------------------------*/ 46 /* Animated Scroll To Anchor 47 /*----------------------------------------------------*/ 48 49 $( 50 '.header a[href^="#"], .page a.btn[href^="#"], .page a.internal-link[href^="#"]' 51 ).on('click', function (e) { 52 e.preventDefault(); 53 54 var target = this.hash, 55 $target = jQuery(target); 56 57 if (!$target.length) return; 58 59 var easing = 60 jQuery.easing && jQuery.easing.easeInSine ? 'easeInSine' : 'swing'; 61 62 $('html, body') 63 .stop() 64 .animate( 65 { 66 scrollTop: $target.offset().top - 60, // - 200px (nav-height) 67 }, 68 'slow', 69 easing, 70 function () { 71 if (window.history && window.history.replaceState) { 72 window.history.replaceState(null, '', target); 73 } else { 74 window.location.hash = target; 75 } 76 } 77 ); 78 }); 79 80 /*----------------------------------------------------*/ 81 /* ScrollUp 82 /*----------------------------------------------------*/ 83 84 $.scrollUp = function (options) { 85 // Defaults 86 var defaults = { 87 scrollName: 'scrollUp', // Element ID 88 topDistance: 600, // Distance from top before showing element (px) 89 topSpeed: 800, // Speed back to top (ms) 90 animation: 'fade', // Fade, slide, none 91 animationInSpeed: 200, // Animation in speed (ms) 92 animationOutSpeed: 200, // Animation out speed (ms) 93 scrollText: '', // Text for element 94 scrollImg: false, // Set true to use image 95 activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF' 96 }; 97 98 var o = $.extend({}, defaults, options), 99 scrollId = '#' + o.scrollName; 100 101 // Create element 102 $('<a/>', { 103 id: o.scrollName, 104 href: '#top', 105 title: o.scrollText, 106 }).appendTo('body'); 107 108 // If not using an image display text 109 if (!o.scrollImg) { 110 $(scrollId).text(o.scrollText); 111 } 112 113 // Minium CSS to make the magic happen 114 $(scrollId).css({ 115 display: 'none', 116 position: 'fixed', 117 'z-index': '2147483647', 118 }); 119 120 // Active point overlay 121 if (o.activeOverlay) { 122 $('body').append("<div id='" + o.scrollName + "-active'></div>"); 123 $(scrollId + '-active').css({ 124 position: 'absolute', 125 top: o.topDistance + 'px', 126 width: '100%', 127 'border-top': '1px dotted ' + o.activeOverlay, 128 'z-index': '2147483647', 129 }); 130 } 131 132 // Scroll function 133 $(window).on('scroll', function () { 134 switch (o.animation) { 135 case 'fade': 136 $( 137 $(window).scrollTop() > o.topDistance 138 ? $(scrollId).fadeIn(o.animationInSpeed) 139 : $(scrollId).fadeOut(o.animationOutSpeed) 140 ); 141 break; 142 case 'slide': 143 $( 144 $(window).scrollTop() > o.topDistance 145 ? $(scrollId).slideDown(o.animationInSpeed) 146 : $(scrollId).slideUp(o.animationOutSpeed) 147 ); 148 break; 149 default: 150 $( 151 $(window).scrollTop() > o.topDistance 152 ? $(scrollId).show(0) 153 : $(scrollId).hide(0) 154 ); 155 } 156 });
157 158 // To the top 159 $(scrollId).on('click', function (event) { 160 $('html, body').animate({ scrollTop: 0 }, o.topSpeed); 161 event.preventDefault(); 162 }); 163 }; 164 165 $.scrollUp(); 166 167 /*----------------------------------------------------*/ 168 /* Video Link #2 Lightbox 169 /*----------------------------------------------------*/ 170 171 // Some pages don't include the Magnific Popup plugin; avoid runtime errors. 172 if ($.fn && typeof $.fn.magnificPopup === 'function') { 173 $('.video-popup2').magnificPopup({ 174 mainClass: 'video-modal', 175 closeOnBgClick: false, 176 type: 'iframe', 177 iframe: { 178 patterns: { 179 youtube: { 180 index: 'youtube.com', 181 src: 'https://www.youtube.com/embed/mb37durvPns?autoplay=1', 182 }, 183 }, 184 }, 185 }); 186 } 187 188 /*----------------------------------------------------*/ 189 /* Statistic Counter 190 /*----------------------------------------------------*/ 191 192 // Some pages don't include the appear plugin; avoid runtime errors. 193 if ($.fn && typeof $.fn.appear === 'function') { 194 $('.count-element').each(function () { 195 $(this).appear( 196 function () { 197 $(this) 198 .prop('Counter', 0) 199 .animate( 200 { 201 Counter: $(this).text(), 202 }, 203 { 204 duration: 4000, 205 easing: 'swing', 206 step: function (now) { 207 $(this).text(Math.ceil(now)); 208 }, 209 } 210 ); 211 }, 212 { accX: 0, accY: 0 } 213 ); 214 }); 215 } 216 217 /*----------------------------------------------------*/ 218 /* Testimonials Rotator 219 /*----------------------------------------------------*/ 220 221 var owl = $('.reviews-holder'); 222 // Some pages don't include OwlCarousel; avoid runtime errors. 223 if ($.fn && typeof $.fn.owlCarousel === 'function') { 224 owl.owlCarousel({ 225 items: 3, 226 loop: true, 227 autoplay: true, 228 navBy: 1, 229 autoplayTimeout: 4500, 230 autoplayHoverPause: false, 231 smartSpeed: 1500, 232 responsive: { 233 0: { 234 items: 1, 235 }, 236 767: { 237 items: 1, 238 }, 239 768: { 240 items: 2, 241 }, 242 991: { 243 items: 3, 244 }, 245 1000: { 246 items: 3, 247 }, 248 }, 249 }); 250 } 251 252 /*----------------------------------------------------*/ 253 /* Reviews Grid 254 /*----------------------------------------------------*/ 255 256 // Some pages don't include imagesLoaded and/or Isotope; avoid runtime errors. 257 if ( 258 $.fn && 259 typeof $.fn.imagesLoaded === 'function' && 260 typeof $.fn.isotope === 'function' 261 ) { 262 $('.grid-loaded').imagesLoaded(function () { 263 var $grid = $('.masonry-wrap').isotope({ 264 itemSelector: '.review-2', 265 percentPosition: true, 266 transitionDuration: '0.7s', 267 masonry: { 268 columnWidth: '.review-2', 269 }, 270 }); 271 }); 272 } 273 274 /*----------------------------------------------------*/ 275 /* Brands Logo Rotator 276 /*----------------------------------------------------*/ 277 278 var owl = $('.brands-carousel'); 279 // Some pages don't include OwlCarousel; avoid runtime errors. 280 if ($.fn && typeof $.fn.owlCarousel === 'function') { 281 owl.owlCarousel({ 282 items: 6, 283 loop: true, 284 autoplay: true, 285 navBy: 1, 286 autoplayTimeout: 4000, 287 autoplayHoverPause: false, 288 smartSpeed: 2000, 289 responsive: { 290 0: { 291 items: 2, 292 }, 293 550: { 294 items: 3, 295 }, 296 767: { 297 items: 3, 298 }, 299 768: { 300 items: 4, 301 }, 302 991: { 303 items: 4, 304 }, 305 1000: { 306 items: 6, 307 }, 308 }, 309 }); 310 } 311 312 /*----------------------------------------------------*/ 313 /* Hero Form Validation 314 /*----------------------------------------------------*/ 315 316 // Some pages don't include jQuery Validate; avoid runtime errors. 317 if ($.fn && typeof $.fn.validate === 'function') { 318 $('.hero-form').validate({ 319 rules: { 320 name: { 321 required: true, 322 minlength: 2, 323 maxlength: 16, 324 }, 325 email: { 326 required: true, 327 email: true, 328 }, 329 phone: { 330 required: true, 331 digits: true, 332 }, 333 subject: { 334 required: true, 335 minlength: 2, 336 }, 337 }, 338 messages: { 339 name: { 340 required: 'Please enter no more than (1) characters', 341 }, 342 email: { 343 required: 'We need your email address to contact you', 344 email: 'Your email address must be in the format of [email protected]', 345 }, 346 phone: { 347 required: 'Please enter only digits', 348 digits: 'Please enter a valid number', 349 }, 350 subject: { 351 required: 'Please enter no more than (1) characters', 352 }, 353 }, 354 });
355 } 356 357 /*----------------------------------------------------*/ 358 /* Register Form Validation 359 /*----------------------------------------------------*/ 360 361 // Some pages don't include jQuery Validate; avoid runtime errors. 362 if ($.fn && typeof $.fn.validate === 'function') { 363 $('.register-form').validate({ 364 rules: { 365 name: { 366 required: true, 367 minlength: 2, 368 maxlength: 16, 369 }, 370 email: { 371 required: true, 372 email: true, 373 }, 374 }, 375 messages: { 376 name: { 377 required: 'Please enter no more than (1) characters', 378 }, 379 email: { 380 required: 'We need your email address to contact you', 381 email: 'Your email address must be in the format of [email protected]', 382 }, 383 }, 384 }); 385 } 386 387 /*----------------------------------------------------*/ 388 /* Contact Form Validation 389 /*----------------------------------------------------*/ 390 391 // Some pages don't include jQuery Validate; avoid runtime errors. 392 if ($.fn && typeof $.fn.validate === 'function') { 393 $('.contact-form').validate({ 394 rules: { 395 name: { 396 required: true, 397 minlength: 1, 398 maxlength: 16, 399 }, 400 email: { 401 required: true, 402 email: true, 403 }, 404 message: { 405 required: true, 406 minlength: 2, 407 }, 408 }, 409 messages: { 410 name: { 411 required: 'Please enter no more than (1) characters', 412 }, 413 email: { 414 required: 'We need your email address to contact you', 415 email: 'Your email address must be in the format of [email protected]', 416 }, 417 message: { 418 required: 'Please enter no more than (2) characters', 419 }, 420 }, 421 }); 422 } 423 424 /*----------------------------------------------------*/ 425 /* Comment Form Validation 426 /*----------------------------------------------------*/ 427 428 // Some pages don't include jQuery Validate; avoid runtime errors. 429 if ($.fn && typeof $.fn.validate === 'function') { 430 $('.comment-form').validate({ 431 rules: { 432 name: { 433 required: true, 434 minlength: 1, 435 maxlength: 16, 436 }, 437 email: { 438 required: true, 439 email: true, 440 }, 441 message: { 442 required: true, 443 minlength: 2, 444 }, 445 }, 446 messages: { 447 name: { 448 required: 'Please enter no more than (1) characters', 449 }, 450 email: { 451 required: 'We need your email address to contact you', 452 email: 'Your email address must be in the format of [email protected]', 453 }, 454 message: { 455 required: 'Please enter no more than (2) characters', 456 }, 457 }, 458 }); 459 } 460 461 /*----------------------------------------------------*/ 462 /* Sticky Bottom Quick 463 /*----------------------------------------------------*/ 464 465 $('.nb-form').hover(function () { 466 $(this).toggleClass('open'); 467 }); 468 469 /*----------------------------------------------------*/ 470 /* Newsletter Subscribe Form 471 /*----------------------------------------------------*/ 472 473 // Some pages don't include ajaxChimp; avoid runtime errors. 474 if ($.fn && typeof $.fn.ajaxChimp === 'function') { 475 $('.newsletter-form').ajaxChimp({ 476 language: 'cm', 477 url: 'http://dsathemes.us3.list-manage.com/subscribe/post?u=af1a6c0b23340d7b339c085b4&id=344a494a6e', 478 //http://xxx.xxx.list-manage.com/subscribe/post?u=xxx&id=xxx 479 }); 480 481 if ($.ajaxChimp && $.ajaxChimp.translations) { 482 $.ajaxChimp.translations.cm = { 483 submit: 'Submitting...', 484 0: 'We have sent you a confirmation email', 485 1: 'Please enter your email address', 486 2: 'An email address must contain a single @', 487 3: 'The domain portion of the email address is invalid (the portion after the @: )', 488 4: 'The username portion of the email address is invalid (the portion before the @: )', 489 5: 'This email address looks fake or invalid. Please enter a real email address', 490 }; 491 } 492 } 493});
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.