1/* Template: Juno - Multipurpose Landing Page Pack 2 Author: InovatikThemes 3 Created: Mar 2019 4 Description: Custom JS file 5*/ 6 7 8(function($) { 9 "use strict"; 10 11 /* Preloader */ 12 $(window).on('load', function() { 13 var preloaderFadeOutTime = 500; 14 function hidePreloader() { 15 var preloader = $('.spinner-wrapper'); 16 setTimeout(function() { 17 preloader.fadeOut(preloaderFadeOutTime); 18 }, 500); 19 } 20 hidePreloader(); 21 }); 22 23 24 /* Navbar Scripts */ 25 // jQuery to collapse the navbar on scroll 26 $(window).on('scroll load', function() { 27 if ($(".navbar").offset().top > 20) { 28 $(".fixed-top").addClass("top-nav-collapse"); 29 $(".lang").addClass("langCollapse"); 30 } else { 31 $(".fixed-top").removeClass("top-nav-collapse"); 32 $(".lang").removeClass("langCollapse"); 33 } 34 }); 35 36 // jQuery for page scrolling feature - requires jQuery Easing plugin 37 $(function() { 38 $(document).on('click', 'a.page-scroll', function(event) { 39 var $anchor = $(this); 40 $('html, body').stop().animate({ 41 scrollTop: $($anchor.attr('href')).offset().top 42 }, 600, 'easeInOutExpo'); 43 event.preventDefault(); 44 }); 45 }); 46 47 // closes the responsive menu on menu item click 48 $(".navbar-nav li a").on("click", function(event) { 49 if (!$(this).parent().hasClass('dropdown')) 50 $(".navbar-collapse").collapse('hide'); 51 }); 52 53 54 /* Rotating Text - Morphtext */ 55 $("#js-rotating").Morphext({ 56 // The [in] animation type. Refer to Animate.css for a list of available animations. 57 animation: "fadeIn", 58 // An array of phrases to rotate are created based on this separator. Change it if you wish to separate the phrases differently (e.g. So Simple | Very Doge | Much Wow | Such Cool). 59 separator: ",", 60 // The delay between the changing of each phrase in milliseconds. 61 speed: 2000, 62 complete: function () { 63 // Called after the entrance animation is executed. 64 } 65 }); 66 67 68 /* Card Slider - Swiper */ 69 var cardSlider = new Swiper('.card-slider', { 70 autoplay: { 71 delay: 4000, 72 disableOnInteraction: false 73 }, 74 loop: true, 75 navigation: { 76 nextEl: '.swiper-button-next', 77 prevEl: '.swiper-button-prev' 78 }, 79 slidesPerView: 3, 80 spaceBetween: 20, 81 breakpoints: { 82 // when window is <= 992px 83 992: { 84 slidesPerView: 2 85 }, 86 // when window is <= 768px 87 768: { 88 slidesPerView: 1 89 } 90 } 91 }); 92 93 94 /* Image Slider - Swiper */ 95 var imageSlider = new Swiper('.image-slider', { 96 autoplay: { 97 delay: 2000, 98 disableOnInteraction: false 99 }, 100 loop: false, 101 navigation: { 102 nextEl: '.swiper-button-next', 103 prevEl: '.swiper-button-prev', 104 }, 105 spaceBetween: 30, 106 slidesPerView: 5, 107 breakpoints: { 108 // when window is <= 380px 109 380: { 110 slidesPerView: 1, 111 spaceBetween: 10 112 }, 113 // when window is <= 516px 114 516: { 115 slidesPerView: 2, 116 spaceBetween: 10 117 }, 118 // when window is <= 768px 119 768: { 120 slidesPerView: 3, 121 spaceBetween: 20 122 }, 123 // when window is <= 992px 124 992: { 125 slidesPerView: 4, 126 spaceBetween: 30 127 }, 128 // when window is <= 1200px 129 1200: { 130 slidesPerView: 5, 131 spaceBetween: 30 132 }, 133 } 134 }); 135 136 137 /* Image Slider - Magnific Popup */ 138 $('.popup-link').magnificPopup({ 139 removalDelay: 300, 140 type: 'image', 141 callbacks: { 142 beforeOpen: function() { 143 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure ' + this.st.el.attr('data-effect')); 144 }, 145 beforeClose: function() { 146 $('.mfp-figure').addClass('fadeOut'); 147 } 148 }, 149 gallery:{ 150 enabled:true //enable gallery mode 151 } 152 }); 153 154 155 /* Video Lightbox - Magnific Popup */ 156 $('.popup-youtube, .popup-vimeo').magnificPopup({ 157 disableOn: 700, 158 type: 'iframe', 159 mainClass: 'mfp-fade', 160 removalDelay: 160, 161 preloader: false,
162 fixedContentPos: false, 163 iframe: { 164 patterns: { 165 youtube: { 166 index: 'youtube.com/', 167 id: function(url) { 168 var m = url.match(/[\\?\\&]v=([^\\?\\&]+)/); 169 if ( !m || !m[1] ) return null; 170 return m[1]; 171 }, 172 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 173 }, 174 vimeo: { 175 index: 'vimeo.com/', 176 id: function(url) { 177 var m = url.match(/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/); 178 if ( !m || !m[5] ) return null; 179 return m[5]; 180 }, 181 src: 'https://player.vimeo.com/video/%id%?autoplay=1' 182 } 183 } 184 } 185 }); 186 187 188 /* Lightbox - Magnific Popup */ 189 $('.popup-with-move-anim').magnificPopup({ 190 type: 'inline', 191 fixedContentPos: false, /* keep it false to avoid html tag shift with margin-right: 17px */ 192 fixedBgPos: true, 193 overflowY: 'auto', 194 closeBtnInside: true, 195 preloader: false, 196 midClick: true, 197 removalDelay: 300, 198 mainClass: 'my-mfp-slide-bottom' 199 }); 200 201 202 /* Counter - CountTo */ 203 var a = 0; 204 $(window).scroll(function() { 205 if ($('#counter').length) { // checking if CountTo section exists in the page, if not it will not run the script and avoid errors 206 var oTop = $('#counter').offset().top - window.innerHeight; 207 if (a == 0 && $(window).scrollTop() > oTop) { 208 $('.counter-value').each(function() { 209 var $this = $(this), 210 countTo = $this.attr('data-count'); 211 $({ 212 countNum: $this.text() 213 }).animate({ 214 countNum: countTo 215 }, 216 { 217 duration: 2000, 218 easing: 'swing', 219 step: function() { 220 $this.text(Math.floor(this.countNum)); 221 }, 222 complete: function() { 223 $this.text(this.countNum); 224 //alert('finished'); 225 } 226 }); 227 }); 228 a = 1; 229 } 230 } 231 }); 232 233 234 /* Move Form Fields Label When User Types */ 235 // for input and textarea fields 236 $("input, textarea").keyup(function(){ 237 if ($(this).val() != '') { 238 $(this).addClass('notEmpty'); 239 } else { 240 $(this).removeClass('notEmpty'); 241 } 242 }); 243 244 245 /* Contact Form */ 246 $("#contactForm").validator().on("submit", function(event) { 247 if (event.isDefaultPrevented()) { 248 // handle the invalid form... 249 cformError(); 250 csubmitMSG(false, "Please fill all fields!"); 251 } else { 252 // everything looks good! 253 event.preventDefault(); 254 csubmitForm(); 255 } 256 }); 257 258 function csubmitForm() { 259 // initiate variables with form content 260 var name = $("#cname").val(); 261 var email = $("#cemail").val(); 262 var message = $("#cmessage").val(); 263 var terms = $("#cterms").val(); 264 $.ajax({ 265 type: "POST", 266 url: "php/contactform-process.php", 267 data: "name=" + name + "&email=" + email + "&message=" + message + "&terms=" + terms, 268 success: function(text) { 269 if (text == "success") { 270 cformSuccess(); 271 } else { 272 cformError(); 273 csubmitMSG(false, text); 274 } 275 } 276 }); 277 } 278 279 function cformSuccess() { 280 $("#contactForm")[0].reset(); 281 csubmitMSG(true, "Message Submitted!"); 282 $("input").removeClass('notEmpty'); // resets the field label after submission 283 $("textarea").removeClass('notEmpty'); // resets the field label after submission 284 } 285 286 function cformError() { 287 $("#contactForm").removeClass().addClass('shake animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() { 288 $(this).removeClass(); 289 }); 290 } 291 292 function csubmitMSG(valid, msg) { 293 if (valid) { 294 var msgClasses = "h3 text-center tada animated"; 295 } else { 296 var msgClasses = "h3 text-center"; 297 } 298 $("#cmsgSubmit").removeClass().addClass(msgClasses).text(msg); 299 } 300 301 302 /* Privacy Form */ 303 $("#privacyForm").validator().on("submit", function(event) { 304 if (event.isDefaultPrevented()) { 305 // handle the invalid form... 306 pformError(); 307 psubmitMSG(false, "Please fill all fields!"); 308 } else { 309 // everything looks good! 310 event.preventDefault();
311 psubmitForm(); 312 } 313 }); 314 315 function psubmitForm() { 316 // initiate variables with form content 317 var name = $("#pname").val(); 318 var email = $("#pemail").val(); 319 var select = $("#pselect").val(); 320 var terms = $("#pterms").val(); 321 322 $.ajax({ 323 type: "POST", 324 url: "php/privacyform-process.php", 325 data: "name=" + name + "&email=" + email + "&select=" + select + "&terms=" + terms, 326 success: function(text) { 327 if (text == "success") { 328 pformSuccess(); 329 } else { 330 pformError(); 331 psubmitMSG(false, text); 332 } 333 } 334 }); 335 } 336 337 function pformSuccess() { 338 $("#privacyForm")[0].reset(); 339 psubmitMSG(true, "Request Submitted!"); 340 $("input").removeClass('notEmpty'); // resets the field label after submission 341 } 342 343 function pformError() { 344 $("#privacyForm").removeClass().addClass('shake animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() { 345 $(this).removeClass(); 346 }); 347 } 348 349 function psubmitMSG(valid, msg) { 350 if (valid) { 351 var msgClasses = "h3 text-center tada animated"; 352 } else { 353 var msgClasses = "h3 text-center"; 354 } 355 $("#pmsgSubmit").removeClass().addClass(msgClasses).text(msg); 356 } 357 358 359 /* Back To Top Button */ 360 // create the back to top button 361 $('body').prepend('<a href="body" class="back-to-top page-scroll">Back to Top</a>'); 362 var amountScrolled = 700; 363 $(window).scroll(function() { 364 if ($(window).scrollTop() > amountScrolled) { 365 $('a.back-to-top').fadeIn('500'); 366 } else { 367 $('a.back-to-top').fadeOut('500'); 368 } 369 }); 370 371 372 /* Removes Long Focus On Buttons */ 373 $(".button, a, button").mouseup(function() { 374 $(this).blur(); 375 }); 376 377})(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.