1/* Theme Name:iDea - Clean & Powerful Bootstrap Theme 2 * Author:HtmlCoder 3 * Author URI:http://www.htmlcoder.me 4 * Author e-mail:[email protected] 5 * Version: 1.3 6 * Created:October 2014 7 * License URI:http://support.wrapbootstrap.com/ 8 * File Description: Initializations of plugins 9 */ 10 11(function ($) { 12 $(document).ready(function () { 13 var timelineBlocks = $(".cd-timeline-block"), 14 offset = 0.8; 15 16 //hide timeline blocks which are outside the viewport 17 hideBlocks(timelineBlocks, offset); 18 19 //on scolling, show/animate timeline blocks when enter the viewport 20 $(window).on("scroll", function () { 21 !window.requestAnimationFrame 22 ? setTimeout(function () { 23 showBlocks(timelineBlocks, offset); 24 }, 100) 25 : window.requestAnimationFrame(function () { 26 showBlocks(timelineBlocks, offset); 27 }); 28 }); 29 30 function setHeightBasedOnContentSize() { 31 var swiper_slide = $(".swiper-slide"); 32 var width = swiper_slide.width(); 33 var aspectRatio = 5 / 4; 34 var slideHeight = width * aspectRatio; 35 36 swiper_slide.height(slideHeight); 37 $(".swiper").height(slideHeight * 2); 38 } 39 40 async function populateInstagramFeed() { 41 const postPerSlide = 10; 42 43 try { 44 let location = window.location.origin + window.location.pathname; 45 let response = await fetch(location + "/instagram-feed"); 46 47 if (!response.ok) { 48 throw new Error(`HTTP error! Status: ${response.status}`); 49 } 50 51 let data = await response.text(); // assuming the response is in JSON format 52 document.getElementById("instagram-feed").innerHTML = data; // assuming data is HTML content 53 54 const swiper = new Swiper(".swiper", { 55 slidesPerView: 2, 56 spaceBetween: 0, 57 preloadImages: true, 58 updateOnImagesReady: true, 59 grid: { 60 rows: 2, 61 }, 62 on: { 63 imagesReady: function () { 64 setHeightBasedOnContentSize(); 65 }, 66 resize: function () { 67 setHeightBasedOnContentSize(); 68 }, 69 }, 70 navigation: { 71 nextEl: ".swiper-button-next", 72 prevEl: ".swiper-button-prev", 73 }, 74 // Responsive breakpoints 75 breakpoints: { 76 576: { 77 slidesPerView: 3, 78 spaceBetween: 0, 79 grid: { 80 rows: 2, 81 }, 82 }, 83 768: { 84 slidesPerView: 4, 85 spaceBetween: 0, 86 grid: { 87 rows: 2, 88 }, 89 }, 90 992: { 91 slidesPerView: 5, 92 spaceBetween: 0, 93 grid: { 94 rows: 2, 95 }, 96 }, 97 }, 98 }); 99 100 setHeightBasedOnContentSize(); 101 } catch (error) { 102 console.error("Error fetching Instagram feed:", error); 103 } 104 } 105 106 if ($("#instagram-feed").length > 0) { 107 populateInstagramFeed(); 108 } 109 110 function hideBlocks(blocks, offset) { 111 blocks.each(function () { 112 $(this).offset().top > 113 $(window).scrollTop() + $(window).height() * offset && 114 $(this) 115 .find(".cd-timeline-img, .cd-timeline-content") 116 .addClass("is-hidden"); 117 }); 118 } 119 120 function showBlocks(blocks, offset) { 121 blocks.each(function () { 122 $(this).offset().top <= 123 $(window).scrollTop() + $(window).height() * offset && 124 $(this).find(".cd-timeline-img").hasClass("is-hidden") && 125 $(this) 126 .find(".cd-timeline-img, .cd-timeline-content") 127 .removeClass("is-hidden") 128 .addClass("bounce-in"); 129 }); 130 } 131 132 $(window).load(function () { 133 $("body").removeClass("no-trans"); 134 }); 135 // Enable Smooth Scroll only on Chrome and only on Win and Linux Systems 136 var platform = navigator.platform.toLowerCase(); 137 if ( 138 (platform.indexOf("win") == 0 || platform.indexOf("linux") == 0) && 139 !Modernizr.touch 140 ) {
141 if ($.support.webkit) { 142 $.webkitSmoothScroll(); 143 console.log("hello webkit"); 144 } 145 } 146 //Show dropdown on hover only for desktop devices 147 //----------------------------------------------- 148 var delay = 0, 149 setTimeoutConst; 150 if ( 151 (Modernizr.mq("only all and (min-width: 768px)") && !Modernizr.touch) || 152 $("html.ie8").length > 0 153 ) { 154 $( 155 ".main-navigation .navbar-nav>li.dropdown, .main-navigation li.dropdown>ul>li.dropdown" 156 ).hover( 157 function () { 158 var $this = $(this); 159 setTimeoutConst = setTimeout(function () { 160 $this.addClass("open").slideDown(); 161 $this.find(".dropdown-toggle").addClass("disabled"); 162 }, delay); 163 }, 164 function () { 165 clearTimeout(setTimeoutConst); 166 $(this).removeClass("open"); 167 $(this).find(".dropdown-toggle").removeClass("disabled"); 168 } 169 ); 170 } 171 //Show dropdown on click only for mobile devices 172 //----------------------------------------------- 173 if (Modernizr.mq("only all and (max-width: 767px)") || Modernizr.touch) { 174 $( 175 ".main-navigation [data-toggle=dropdown], .header-top [data-toggle=dropdown]" 176 ).on("click", function (event) { 177 // Avoid following the href location when clicking 178 event.preventDefault(); 179 // Avoid having the menu to close when clicking 180 event.stopPropagation(); 181 // close all the siblings 182 $(this).parent().siblings().removeClass("open"); 183 // close all the submenus of siblings 184 $(this) 185 .parent() 186 .siblings() 187 .find("[data-toggle=dropdown]") 188 .parent() 189 .removeClass("open"); 190 // opening the one you clicked on 191 $(this).parent().toggleClass("open"); 192 }); 193 } 194 //Main slider 195 //----------------------------------------------- 196 197 //Revolution Slider 198 if ($(".slider-banner-container").length > 0) { 199 $(".tp-bannertimer").show(); 200 201 $(".slider-banner-container .slider-banner").show().revolution({ 202 delay: 10000, 203 startwidth: 1500, 204 startheight: 500, 205 lazyLoad: "on", 206 /* Lazy Load options are "all", "smart", "single" and "none" */ 207 lazyType: "single", 208 209 navigationArrows: "solo", 210 211 navigationStyle: "round", 212 navigationHAlign: "center", 213 navigationVAlign: "bottom", 214 navigationHOffset: 0, 215 navigationVOffset: 20, 216 217 soloArrowLeftHalign: "left", 218 soloArrowLeftValign: "center", 219 soloArrowLeftHOffset: 20, 220 soloArrowLeftVOffset: 0, 221 222 soloArrowRightHalign: "right", 223 soloArrowRightValign: "center", 224 soloArrowRightHOffset: 20, 225 soloArrowRightVOffset: 0, 226 227 fullWidth: "on", 228 229 spinner: "spinner0", 230 231 stopLoop: "off", 232 stopAfterLoops: -1, 233 stopAtSlide: -1, 234 onHoverStop: "off", 235 236 shuffle: "off", 237 238 autoHeight: "off", 239 forceFullWidth: "off", 240 241 hideThumbsOnMobile: "off", 242 hideNavDelayOnMobile: 1500, 243 hideBulletsOnMobile: "off", 244 hideArrowsOnMobile: "off", 245 hideThumbsUnderResolution: 0, 246 247 hideSliderAtLimit: 0, 248 hideCaptionAtLimit: 0, 249 hideAllCaptionAtLilmit: 0, 250 startWithSlide: 0, 251 }); 252 253 $(".slider-banner-container .slider-banner-2").show().revolution({ 254 delay: 10000, 255 startwidth: 1140, 256 startheight: 520, 257 258 navigationArrows: "solo", 259 260 navigationStyle: "preview4", 261 navigationHAlign: "center", 262 navigationVAlign: "bottom", 263 navigationHOffset: 0, 264 navigationVOffset: 20, 265 266 soloArrowLeftHalign: "left", 267 soloArrowLeftValign: "center", 268 soloArrowLeftHOffset: 20, 269 soloArrowLeftVOffset: 0, 270 271 soloArrowRightHalign: "right", 272 soloArrowRightValign: "center", 273 soloArrowRightHOffset: 20, 274 soloArrowRightVOffset: 0, 275 276 fullWidth: "on", 277 278 spinner: "spinner0", 279 280 stopLoop: "off", 281 stopAfterLoops: -1, 282 stopAtSlide: -1, 283 onHoverStop: "off", 284 285 shuffle: "off", 286 287 autoHeight: "off", 288 forceFullWidth: "off", 289 290 hideThumbsOnMobile: "off", 291 hideNavDelayOnMobile: 1500, 292 hideBulletsOnMobile: "off", 293 hideArrowsOnMobile: "off", 294 hideThumbsUnderResolution: 0, 295 296 hideSliderAtLimit: 0, 297 hideCaptionAtLimit: 0, 298 hideAllCaptionAtLilmit: 0, 299 startWithSlide: 0, 300 }); 301 302 $(".slider-banner-container .slider-banner-3") 303 .show() 304 .revolution({ 305 delay: 10000, 306 startwidth: 1140, 307 startheight: 520, 308 dottedOverlay: "twoxtwo", 309 310 parallax: "mouse", 311 parallaxBgFreeze: "on", 312 parallaxLevels: [3, 2, 1], 313 314 navigationArrows: "solo", 315 316 navigationStyle: "preview5", 317 navigationHAlign: "center", 318 navigationVAlign: "bottom", 319 navigationHOffset: 0, 320 navigationVOffset: 20, 321 322 soloArrowLeftHalign: "left", 323 soloArrowLeftValign: "center", 324 soloArrowLeftHOffset: 20, 325 soloArrowLeftVOffset: 0, 326 327 soloArrowRightHalign: "right", 328 soloArrowRightValign: "center", 329 soloArrowRightHOffset: 20, 330 soloArrowRightVOffset: 0, 331 332 fullWidth: "on", 333 334 spinner: "spinner0", 335 336 stopLoop: "off", 337 stopAfterLoops: -1, 338 stopAtSlide: -1, 339 onHoverStop: "off", 340 341 shuffle: "off", 342 343 autoHeight: "off", 344 forceFullWidth: "off", 345 346 hideThumbsOnMobile: "off", 347 hideNavDelayOnMobile: 1500, 348 hideBulletsOnMobile: "off", 349 hideArrowsOnMobile: "off", 350 hideThumbsUnderResolution: 0, 351 352 hideSliderAtLimit: 0, 353 hideCaptionAtLimit: 0, 354 hideAllCaptionAtLilmit: 0, 355 startWithSlide: 0, 356 }); 357 358 if ( 359 $(".transparent.header").length > 0 || 360 $(".offcanvas-container").length > 0 361 ) { 362 $(".slider-banner-container .slider-banner-fullscreen") 363 .show() 364 .revolution({ 365 delay: 10000, 366 startwidth: 1140, 367 startheight: 520, 368 fullWidth: "off", 369 fullScreen: "on", 370 fullScreenOffsetContainer: "", 371 fullScreenOffset: "", 372 373 navigationArrows: "solo", 374 375 navigationStyle: "preview4", 376 navigationHAlign: "center", 377 navigationVAlign: "bottom", 378 navigationHOffset: 0, 379 navigationVOffset: 20, 380 381 soloArrowLeftHalign: "left", 382 soloArrowLeftValign: "center", 383 soloArrowLeftHOffset: 20, 384 soloArrowLeftVOffset: 0, 385 386 soloArrowRightHalign: "right", 387 soloArrowRightValign: "center", 388 soloArrowRightHOffset: 20, 389 soloArrowRightVOffset: 0, 390 391 spinner: "spinner4", 392 393 stopLoop: "off", 394 stopAfterLoops: -1, 395 stopAtSlide: -1, 396 onHoverStop: "off", 397 398 shuffle: "off", 399 hideTimerBar: "on", 400 401 autoHeight: "off", 402 forceFullWidth: "off", 403 404 hideThumbsOnMobile: "off", 405 hideNavDelayOnMobile: 1500, 406 hideBulletsOnMobile: "off", 407 hideArrowsOnMobile: "off", 408 hideThumbsUnderResolution: 0, 409 410 hideSliderAtLimit: 0, 411 hideCaptionAtLimit: 0, 412 hideAllCaptionAtLilmit: 0, 413 startWithSlide: 0, 414 }); 415 } else { 416 $(".slider-banner-container .slider-banner-fullscreen") 417 .show() 418 .revolution({ 419 delay: 10000, 420 startwidth: 1140, 421 startheight: 520, 422 fullWidth: "off", 423 fullScreen: "on", 424 fullScreenOffsetContainer: "", 425 fullScreenOffset: "82px", 426 427 navigationArrows: "solo", 428 429 navigationStyle: "preview4", 430 navigationHAlign: "center", 431 navigationVAlign: "bottom", 432 navigationHOffset: 0, 433 navigationVOffset: 20, 434 435 soloArrowLeftHalign: "left", 436 soloArrowLeftValign: "center", 437 soloArrowLeftHOffset: 20, 438 soloArrowLeftVOffset: 0, 439 440 soloArrowRightHalign: "right", 441 soloArrowRightValign: "center", 442 soloArrowRightHOffset: 20, 443 soloArrowRightVOffset: 0, 444 445 spinner: "spinner4", 446 447 stopLoop: "off", 448 stopAfterLoops: -1, 449 stopAtSlide: -1, 450 onHoverStop: "off", 451 452 shuffle: "off", 453 hideTimerBar: "on", 454 455 autoHeight: "off", 456 forceFullWidth: "off", 457 458 hideThumbsOnMobile: "off", 459 hideNavDelayOnMobile: 1500, 460 hideBulletsOnMobile: "off", 461 hideArrowsOnMobile: "off", 462 hideThumbsUnderResolution: 0, 463 464 hideSliderAtLimit: 0, 465 hideCaptionAtLimit: 0, 466 hideAllCaptionAtLilmit: 0, 467 startWithSlide: 0, 468 }); 469 } 470 if ( 471 $(".transparent.header").length > 0 || 472 $(".offcanvas-container").length > 0 473 ) { 474 $(".slider-banner-container .slider-banner-fullscreen-alt-nav") 475 .show() 476 .revolution({ 477 delay: 10000, 478 startwidth: 1140, 479 startheight: 520, 480 fullWidth: "off", 481 fullScreen: "on", 482 fullScreenOffsetContainer: "", 483 fullScreenOffset: "", 484 485 navigationArrows: "solo", 486 487 navigationStyle: "preview2", 488 navigationHAlign: "center", 489 navigationVAlign: "bottom", 490 navigationHOffset: 0, 491 navigationVOffset: 20, 492 493 soloArrowLeftHalign: "left", 494 soloArrowLeftValign: "center", 495 soloArrowLeftHOffset: 20, 496 soloArrowLeftVOffset: 0, 497 498 soloArrowRightHalign: "right", 499 soloArrowRightValign: "center", 500 soloArrowRightHOffset: 20, 501 soloArrowRightVOffset: 0, 502 503 spinner: "spinner4", 504 505 stopLoop: "off", 506 stopAfterLoops: -1, 507 stopAtSlide: -1, 508 onHoverStop: "off", 509 510 shuffle: "off", 511 hideTimerBar: "on", 512 513 autoHeight: "off", 514 forceFullWidth: "off", 515 516 hideThumbsOnMobile: "off", 517 hideNavDelayOnMobile: 1500, 518 hideBulletsOnMobile: "off", 519 hideArrowsOnMobile: "off", 520 hideThumbsUnderResolution: 0, 521 522 hideSliderAtLimit: 0, 523 hideCaptionAtLimit: 0, 524 hideAllCaptionAtLilmit: 0, 525 startWithSlide: 0, 526 }); 527 } else { 528 $(".slider-banner-container .slider-banner-fullscreen-alt-nav") 529 .show() 530 .revolution({ 531 delay: 10000, 532 startwidth: 1140, 533 startheight: 520, 534 fullWidth: "off", 535 fullScreen: "on", 536 fullScreenOffsetContainer: "", 537 fullScreenOffset: "82px", 538 539 navigationArrows: "solo", 540 541 navigationStyle: "preview2", 542 navigationHAlign: "center", 543 navigationVAlign: "bottom", 544 navigationHOffset: 0, 545 navigationVOffset: 20, 546 547 soloArrowLeftHalign: "left", 548 soloArrowLeftValign: "center", 549 soloArrowLeftHOffset: 20, 550 soloArrowLeftVOffset: 0, 551 552 soloArrowRightHalign: "right", 553 soloArrowRightValign: "center", 554 soloArrowRightHOffset: 20, 555 soloArrowRightVOffset: 0, 556 557 spinner: "spinner4", 558 559 stopLoop: "off", 560 stopAfterLoops: -1, 561 stopAtSlide: -1, 562 onHoverStop: "off", 563 564 shuffle: "off", 565 hideTimerBar: "on", 566 567 autoHeight: "off", 568 forceFullWidth: "off", 569 570 hideThumbsOnMobile: "off", 571 hideNavDelayOnMobile: 1500, 572 hideBulletsOnMobile: "off", 573 hideArrowsOnMobile: "off", 574 hideThumbsUnderResolution: 0, 575 576 hideSliderAtLimit: 0, 577 hideCaptionAtLimit: 0, 578 hideAllCaptionAtLilmit: 0, 579 startWithSlide: 0, 580 }); 581 } 582 var sliders_count = $(".slider-list").length; 583 for (var i = 0; i < sliders_count; i++) { 584 var titleSlider = $("#titleSlider" + i); 585 var subtitleSlider = $("#subtitleSlider" + i); 586 var buttonSlider = $("#buttonSlider" + i); 587 588 //SLIDER SET POSITION DESCRIPTION (SUBTITLE) 589 var heightTitleSlider = titleSlider.height(); 590 var topTitle = titleSlider.data("y"); 591 subtitleSlider.data("y", heightTitleSlider + topTitle); 592 593 //SLIDER SET POSITION BUTTON
594 var heightSubtitleSlider = subtitleSlider.height(); 595 var topSubtitle = subtitleSlider.data("y"); 596 597 //check if subslider and slider are set to set position of button 598 if (subtitleSlider.length) { 599 buttonSlider.data("y", heightSubtitleSlider + topSubtitle); 600 } else if (titleSlider.length) { 601 buttonSlider.data("y", heightTitleSlider + topTitle); 602 } else { 603 buttonSlider.data("y", 50); 604 } 605 } 606 } 607 //Owl carousel 608 //----------------------------------------------- 609 if ($(".owl-carousel").length > 0) { 610 $(".owl-carousel.carousel").owlCarousel({ 611 items: 4, 612 pagination: false, 613 navigation: true, 614 navigationText: false, 615 }); 616 $(".owl-carousel.carousel-autoplay").owlCarousel({ 617 items: 4, 618 autoPlay: 5000, 619 pagination: false, 620 navigation: true, 621 navigationText: false, 622 }); 623 $(".owl-carousel.clients").owlCarousel({ 624 items: 4, 625 autoPlay: true, 626 pagination: false, 627 itemsDesktopSmall: [992, 5], 628 itemsTablet: [768, 4], 629 itemsMobile: [479, 3], 630 }); 631 $(".owl-carousel.content-slider").owlCarousel({ 632 singleItem: true, 633 autoPlay: 5000, 634 navigation: false, 635 navigationText: false, 636 pagination: false, 637 }); 638 $(".owl-carousel.content-slider-with-controls").owlCarousel({ 639 singleItem: true, 640 autoPlay: false, 641 navigation: true, 642 navigationText: false, 643 pagination: true, 644 }); 645 $(".owl-carousel.content-slider-with-controls-autoplay").owlCarousel({ 646 singleItem: true, 647 autoPlay: 5000, 648 navigation: true, 649 navigationText: false, 650 pagination: true, 651 }); 652 $(".owl-carousel.content-slider-with-controls-bottom").owlCarousel({ 653 singleItem: true, 654 autoPlay: false, 655 navigation: true, 656 navigationText: false, 657 pagination: true, 658 }); 659 } 660 // Animations 661 //----------------------------------------------- 662 if ($("[data-animation-effect]").length > 0 && !Modernizr.touch) { 663 $("[data-animation-effect]").each(function () { 664 var item = $(this), 665 animationEffect = item.attr("data-animation-effect"); 666 667 if ( 668 Modernizr.mq("only all and (min-width: 768px)") && 669 Modernizr.csstransitions 670 ) { 671 item.appear( 672 function () { 673 if (item.attr("data-effect-delay")) 674 item.css("effect-delay", delay + "ms"); 675 setTimeout(function () { 676 item.addClass("animated object-visible " + animationEffect); 677 }, item.attr("data-effect-delay")); 678 }, 679 { accX: 0, accY: -130 } 680 ); 681 } else { 682 item.addClass("object-visible"); 683 } 684 }); 685 } 686 // Text Rotators 687 //----------------------------------------------- 688 if ($(".text-rotator").length > 0) { 689 $(".text-rotator").each(function () { 690 var tr_animationEffect = $(this).attr("data-rotator-animation-effect"); 691 $(this).Morphext({ 692 animation: "" + tr_animationEffect + "", // Overrides default "bounceIn" 693 separator: ",", // Overrides default "," 694 speed: 5000, // Overrides default 2000 695 }); 696 }); 697 } 698 // Stats Count To 699 //----------------------------------------------- 700 if ($(".stats [data-to]").length > 0) { 701 $(".stats [data-to]").each(function () { 702 var stat_item = $(this), 703 offset = stat_item.offset().top; 704 if ( 705 $(window).scrollTop() > offset - 800 && 706 !stat_item.hasClass("counting") 707 ) { 708 stat_item.addClass("counting"); 709 stat_item.countTo(); 710 } 711 $(window).scroll(function () { 712 if ( 713 $(window).scrollTop() > offset - 800 && 714 !stat_item.hasClass("counting") 715 ) { 716 stat_item.addClass("counting"); 717 stat_item.countTo(); 718 } 719 }); 720 }); 721 } 722 // Isotope filters 723 //----------------------------------------------- 724 if ( 725 $(".isotope-container").length > 0 || 726 $(".masonry-grid").length > 0 || 727 $(".masonry-grid-fitrows").length > 0 728 ) { 729 $(window).load(function () { 730 $(".masonry-grid").isotope({ 731 itemSelector: ".masonry-grid-item", 732 layoutMode: "masonry", 733 }); 734 $(".masonry-grid-fitrows").isotope({ 735 itemSelector: ".masonry-grid-item", 736 layoutMode: "fitRows", 737 }); 738 $(".isotope-container").fadeIn(); 739 var $container = $(".isotope-container").isotope({ 740 itemSelector: ".isotope-item", 741 layoutMode: "masonry", 742 transitionDuration: "0.6s", 743 filter: "*", 744 }); 745 // filter items on button click 746 $(".filters").on("click", "ul.nav li a", function () { 747 var filterValue = $(this).attr("data-filter"); 748 $(".filters").find("li.active").removeClass("active"); 749 $(this).parent().addClass("active"); 750 $container.isotope({ filter: filterValue }); 751 return false;
752 }); 753 }); 754 } 755 //hc-tabs 756 //----------------------------------------------- 757 if ($(".hc-tabs").length > 0) { 758 $(window).load(function () { 759 var currentTab = $(".hc-tabs .nav.nav-tabs li.active a").attr("href"), 760 tabsImageAnimation = $(".hc-tabs-top") 761 .find("[data-tab='" + currentTab + "']") 762 .attr("data-tab-animation-effect"); 763 $(".hc-tabs-top") 764 .find("[data-tab='" + currentTab + "']") 765 .addClass("current-img show " + tabsImageAnimation + " animated"); 766 767 $(".hc-tabs .nav.nav-tabs li a").on("click", function (event) { 768 var currentTab = $(this).attr("href"), 769 tabsImageAnimation = $(".hc-tabs-top") 770 .find("[data-tab='" + currentTab + "']") 771 .attr("data-tab-animation-effect"); 772 $(".current-img").removeClass( 773 "current-img show " + tabsImageAnimation + " animated" 774 ); 775 $(".hc-tabs-top") 776 .find("[data-tab='" + currentTab + "']") 777 .addClass("current-img show " + tabsImageAnimation + " animated"); 778 }); 779 }); 780 } 781 782 // Animated Progress Bars 783 //----------------------------------------------- 784 if ($("[data-animate-width]").length > 0) { 785 $("[data-animate-width]").each(function () { 786 $(this).appear( 787 function () { 788 $(this).animate( 789 { 790 width: $(this).attr("data-animate-width"), 791 }, 792 800 793 ); 794 }, 795 { accX: 0, accY: -100 } 796 ); 797 }); 798 } 799 // Animated Progress Bars 800 //----------------------------------------------- 801 if ($(".knob").length > 0) { 802 $(".knob").knob(); 803 } 804 805 // Charts 806 //----------------------------------------------- 807 if ($(".graph").length > 0) { 808 // Creates random numbers you don't need this for real graphs 809 var randomScalingFactor = function () { 810 return Math.round(Math.random() * 500); 811 }; 812 813 if ($(".graph.line").length > 0) { 814 // Data for line charts 815 var lineChartData = { 816 labels: [ 817 "January", 818 "February", 819 "March", 820 "April", 821 "May", 822 "June", 823 "July", 824 ], 825 datasets: [ 826 { 827 label: "First dataset", 828 fillColor: "rgba(188,188,188,0.2)", 829 strokeColor: "rgba(188,188,188,1)", 830 pointColor: "rgba(188,188,188,1)", 831 pointStrokeColor: "#fff", 832 pointHighlightFill: "#fff", 833 pointHighlightStroke: "rgba(188,188,188,1)", 834 data: [250, 300, 250, 200, 250, 300, 250], 835 }, 836 { 837 label: "Second dataset", 838 fillColor: "rgba(126,187,205,0.2)", 839 strokeColor: "rgba(126,187,205,1)", 840 pointColor: "rgba(126,187,205,1)", 841 pointStrokeColor: "#fff", 842 pointHighlightFill: "#fff", 843 pointHighlightStroke: "rgba(126,187,205,1)", 844 data: [300, 250, 200, 250, 300, 250, 200], 845 }, 846 { 847 label: "Third dataset", 848 fillColor: "rgba(98,187,205,0.2)", 849 strokeColor: "rgba(98,187,205,1)", 850 pointColor: "rgba(98,187,205,1)", 851 pointStrokeColor: "#fff", 852 pointHighlightFill: "#fff", 853 pointHighlightStroke: "rgba(98,187,205,1)", 854 data: [0, 100, 200, 300, 400, 500, 400], 855 }, 856 ], 857 }; 858 859 // Line Charts Initialization 860 $(window).load(function () { 861 var ctx = document.getElementById("lines-graph").getContext("2d"); 862 window.newLine = new Chart(ctx).Line(lineChartData, { 863 responsive: true, 864 bezierCurve: false, 865 }); 866 }); 867 } 868 if ($(".graph.bar").length > 0) { 869 // Data for bar charts 870 var barChartData = { 871 labels: [ 872 "January", 873 "February", 874 "March", 875 "April", 876 "May", 877 "June", 878 "July", 879 ], 880 datasets: [ 881 { 882 fillColor: "rgba(188,188,188,0.5)", 883 strokeColor: "rgba(188,188,188,0.8)", 884 highlightFill: "rgba(188,188,188,0.75)", 885 highlightStroke: "rgba(188,188,188,1)", 886 data: [ 887 randomScalingFactor(), 888 randomScalingFactor(), 889 randomScalingFactor(), 890 randomScalingFactor(), 891 randomScalingFactor(), 892 randomScalingFactor(), 893 randomScalingFactor(), 894 ], 895 }, 896 { 897 fillColor: "rgba(168,187,205,0.5)", 898 strokeColor: "rgba(168,187,205,0.8)", 899 highlightFill: "rgba(168,187,205,0.75)", 900 highlightStroke: "rgba(168,187,205,1)", 901 data: [ 902 randomScalingFactor(), 903 randomScalingFactor(), 904 randomScalingFactor(), 905 randomScalingFactor(), 906 randomScalingFactor(), 907 randomScalingFactor(), 908 randomScalingFactor(), 909 ], 910 }, 911 ], 912 }; 913 914 // Bar Charts Initialization 915 $(window).load(function () { 916 var ctx = document.getElementById("bars-graph").getContext("2d"); 917 window.myBar = new Chart(ctx).Bar(barChartData, { 918 responsive: true, 919 }); 920 }); 921 } 922 if ($(".graph.pie").length > 0) { 923 // Data for pie chart 924 var pieData = [ 925 { 926 value: 120, 927 color: "#09afdf", 928 highlight: "#6BD5F4", 929 label: "Blue", 930 }, 931 { 932 value: 120, 933 color: "#FDB45C", 934 highlight: "#FFC870", 935 label: "Yellow", 936 }, 937 { 938 value: 120, 939 color: "#4D5360", 940 highlight: "#616774", 941 label: "Dark Grey", 942 }, 943 ]; 944 945 // Pie Chart Initialization 946 $(window).load(function () { 947 var ctx = document.getElementById("pie-graph").getContext("2d"); 948 window.myPie = new Chart(ctx).Pie(pieData); 949 }); 950 } 951 if ($(".graph.doughnut").length > 0) { 952 // Data for doughnut chart 953 var doughnutData = [ 954 { 955 value: 120, 956 color: "#09afdf", 957 highlight: "#6BD5F4", 958 label: "Blue", 959 }, 960 { 961 value: 120, 962 color: "#FDB45C", 963 highlight: "#FFC870", 964 label: "Yellow", 965 }, 966 { 967 value: 120, 968 color: "#4D5360", 969 highlight: "#616774", 970 label: "Dark Grey", 971 }, 972 ]; 973 974 // Doughnut Chart Initialization 975 $(window).load(function () { 976 var ctx = document.getElementById("doughnut-graph").getContext("2d");
977 window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, { 978 responsive: true, 979 }); 980 }); 981 } 982 } 983 // Magnific popup 984 //----------------------------------------------- 985 if ( 986 $(".popup-img").length > 0 || 987 $(".popup-iframe").length > 0 || 988 $(".popup-img-single").length > 0 989 ) { 990 $(".owl-carousel").each(function () { 991 // the containers for all your galleries 992 $(this).magnificPopup({ 993 delegate: "a", // the selector for gallery item 994 type: "image", 995 gallery: { 996 enabled: true, 997 }, 998 }); 999 }); 1000 $(".popup-img-single").magnificPopup({ 1001 type: "image", 1002 gallery: { 1003 enabled: false, 1004 }, 1005 }); 1006 $(".popup-iframe").magnificPopup({ 1007 disableOn: 700, 1008 type: "iframe", 1009 preloader: false, 1010 fixedContentPos: false, 1011 }); 1012 } 1013 // Fixed header 1014 //----------------------------------------------- 1015 var headerTopHeight = $(".header-top").outerHeight(), 1016 headerHeight = $("header.header.fixed").outerHeight(); 1017 $(window).scroll(function () { 1018 if ($(".header.fixed").length > 0) { 1019 if ( 1020 $(this).scrollTop() > headerTopHeight + headerHeight && 1021 $(window).width() > 767 1022 ) { 1023 $("body").addClass("fixed-header-on"); 1024 $(".header.fixed").addClass("animated object-visible fadeInDown"); 1025 var headerFixed = $("header.header.clearfix.fadeInDown"); 1026 var headerFixedHeight = headerFixed.height(); 1027 $(".row-filter-search-ecommerce").css( 1028 "top", 1029 headerFixedHeight + "px" 1030 ); 1031 if (!($(".header.transparent").length > 0)) { 1032 if ($(".banner:not(.header-top)").length > 0) { 1033 $(".banner").css("marginTop", headerHeight + "px"); 1034 } else if ($(".page-intro").length > 0) { 1035 $(".page-intro").css("marginTop", headerHeight + "px"); 1036 } else if ($(".page-top").length > 0) { 1037 $(".page-top").css("marginTop", headerHeight + "px"); 1038 } else { 1039 //$("section.main-container").css("marginTop", (headerHeight) + "px"); 1040 } 1041 } 1042 } else { 1043 $("body").removeClass("fixed-header-on"); 1044 //$("section.main-container").css("marginTop", (0) + "px"); 1045 $(".banner").css("marginTop", 0 + "px"); 1046 $(".page-intro").css("marginTop", 0 + "px"); 1047 $(".page-top").css("marginTop", 0 + "px"); 1048 $(".header.fixed").removeClass("animated object-visible fadeInDown"); 1049 } 1050 } 1051 }); 1052 1053 // Sharrre plugin 1054 //----------------------------------------------- 1055 if ($("#share").length > 0) { 1056 $("#share").sharrre({ 1057 share: { 1058 twitter: true, 1059 facebook: true, 1060 googlePlus: true, 1061 }, 1062 template: 1063 '<ul class="social-links clearfix"><li class="facebook"><a href="#"><i class="fa fa-facebook"></i></a></li><li class="twitter"><a href="#"><i class="fa fa-x-twitter"></i></a></li><li class="googleplus"><a href="#"><i class="fa fa-google-plus"></i></a></li></ul>', 1064 enableHover: false, 1065 enableTracking: true, 1066 render: function (api, options) { 1067 $(api.element).on("click", ".twitter a", function () { 1068 api.openPopup("twitter"); 1069 }); 1070 $(api.element).on("click", ".facebook a", function () { 1071 api.openPopup("facebook"); 1072 }); 1073 $(api.element).on("click", ".googleplus a", function () { 1074 api.openPopup("googlePlus"); 1075 }); 1076 }, 1077 }); 1078 } 1079 // Contact forms validation 1080 //----------------------------------------------- 1081 if ($("#contact-form").length > 0) { 1082 $("#contact-form").validate({ 1083 submitHandler: function (form) { 1084 $(".submit-button").button("loading"); 1085 $.ajax({ 1086 type: "POST", 1087 url: "php/email-sender.php", 1088 data: { 1089 name: $("#contact-form #name").val(), 1090 email: $("#contact-form #email").val(), 1091 subject: $("#contact-form #subject").val(), 1092 message: $("#contact-form #message").val(), 1093 }, 1094 dataType: "json", 1095 success: function (data) { 1096 if (data.sent == "yes") { 1097 $("#MessageSent").removeClass("hidden"); 1098 $("#MessageNotSent").addClass("hidden"); 1099 $(".submit-button") 1100 .removeClass("btn-default") 1101 .addClass("btn-success") 1102 .prop("value", "Message Sent"); 1103 $("#contact-form .form-control").each(function () { 1104 $(this) 1105 .prop("value", "") 1106 .parent() 1107 .removeClass("has-success") 1108 .removeClass("has-error"); 1109 }); 1110 } else { 1111 $("#MessageNotSent").removeClass("hidden"); 1112 $("#MessageSent").addClass("hidden"); 1113 } 1114 }, 1115 }); 1116 }, 1117 // debug: true, 1118 errorPlacement: function (error, element) { 1119 error.insertBefore(element); 1120 }, 1121 onkeyup: false, 1122 onclick: false, 1123 rules: { 1124 name: { 1125 required: true, 1126 minlength: 2, 1127 }, 1128 email: { 1129 required: true, 1130 email: true, 1131 }, 1132 subject: { 1133 required: true, 1134 }, 1135 message: { 1136 required: true, 1137 minlength: 10, 1138 }, 1139 }, 1140 messages: { 1141 name: { 1142 required: "Please specify your name", 1143 minlength: "Your name must be longer than 2 characters", 1144 }, 1145 email: { 1146 required: "We need your email address to contact you", 1147 email: "Please enter a valid email address e.g. [email protected]", 1148 }, 1149 subject: { 1150 required: "Please enter a subject", 1151 }, 1152 message: { 1153 required: "Please enter a message", 1154 minlength: "Your message must be longer than 10 characters", 1155 }, 1156 }, 1157 errorElement: "span", 1158 highlight: function (element) { 1159 $(element).parent().removeClass("has-success").addClass("has-error"); 1160 $(element).siblings("label").addClass("hide"); 1161 }, 1162 success: function (element) { 1163 $(element).parent().removeClass("has-error").addClass("has-success"); 1164 $(element).siblings("label").removeClass("hide"); 1165 }, 1166 }); 1167 } 1168 if ($("#footer-form").length > 0) { 1169 $("#footer-form").validate({ 1170 submitHandler: function (form) { 1171 $(".submit-button").button("loading"); 1172 $.ajax({ 1173 type: "POST", 1174 url: "php/email-sender.php", 1175 data: { 1176 name: $("#footer-form #name2").val(), 1177 email: $("#footer-form #email2").val(), 1178 subject: "Message from contact form", 1179 message: $("#footer-form #message2").val(), 1180 }, 1181 dataType: "json", 1182 success: function (data) { 1183 if (data.sent == "yes") { 1184 $("#MessageSent2").removeClass("hidden"); 1185 $("#MessageNotSent2").addClass("hidden"); 1186 $(".submit-button") 1187 .removeClass("btn-default") 1188 .addClass("btn-success") 1189 .prop("value", "Message Sent"); 1190 $("#footer-form .form-control").each(function () { 1191 $(this) 1192 .prop("value", "") 1193 .parent() 1194 .removeClass("has-success") 1195 .removeClass("has-error"); 1196 }); 1197 } else { 1198 $("#MessageNotSent2").removeClass("hidden"); 1199 $("#MessageSent2").addClass("hidden"); 1200 } 1201 }, 1202 }); 1203 }, 1204 // debug: true, 1205 errorPlacement: function (error, element) { 1206 error.insertAfter(element); 1207 }, 1208 onkeyup: false, 1209 onclick: false, 1210 rules: { 1211 name2: { 1212 required: true, 1213 minlength: 2, 1214 }, 1215 email2: { 1216 required: true, 1217 email: true, 1218 }, 1219 message2: { 1220 required: true, 1221 minlength: 10, 1222 }, 1223 }, 1224 messages: { 1225 name2: { 1226 required: "Please specify your name", 1227 minlength: "Your name must be longer than 2 characters", 1228 }, 1229 email2: { 1230 required: "We need your email address to contact you", 1231 email: "Please enter a valid email address e.g. [email protected]", 1232 }, 1233 message2: { 1234 required: "Please enter a message", 1235 minlength: "Your message must be longer than 10 characters", 1236 }, 1237 }, 1238 errorElement: "span", 1239 highlight: function (element) { 1240 $(element).parent().removeClass("has-success").addClass("has-error"); 1241 $(element).siblings("label").addClass("hide"); 1242 }, 1243 success: function (element) { 1244 $(element).parent().removeClass("has-error").addClass("has-success"); 1245 $(element).siblings("label").removeClass("hide"); 1246 }, 1247 }); 1248 } 1249 if ($("#sidebar-form").length > 0) { 1250 $("#sidebar-form").validate({ 1251 submitHandler: function (form) { 1252 $(".submit-button").button("loading"); 1253 $.ajax({ 1254 type: "POST", 1255 url: "php/email-sender.php", 1256 data: { 1257 name: $("#sidebar-form #name3").val(), 1258 email: $("#sidebar-form #email3").val(), 1259 subject: "Message from FAQ page", 1260 category: $("#sidebar-form #category").val(), 1261 message: $("#sidebar-form #message3").val(), 1262 }, 1263 dataType: "json", 1264 success: function (data) { 1265 if (data.sent == "yes") { 1266 $("#MessageSent3").removeClass("hidden"); 1267 $("#MessageNotSent3").addClass("hidden"); 1268 $(".submit-button") 1269 .removeClass("btn-default") 1270 .addClass("btn-success") 1271 .prop("value", "Message Sent"); 1272 $("#sidebar-form .form-control").each(function () { 1273 $(this) 1274 .prop("value", "") 1275 .parent() 1276 .removeClass("has-success") 1277 .removeClass("has-error"); 1278 }); 1279 } else { 1280 $("#MessageNotSent3").removeClass("hidden"); 1281 $("#MessageSent3").addClass("hidden"); 1282 } 1283 }, 1284 }); 1285 }, 1286 // debug: true, 1287 errorPlacement: function (error, element) { 1288 error.insertAfter(element); 1289 }, 1290 onkeyup: false, 1291 onclick: false, 1292 rules: { 1293 name3: { 1294 required: true, 1295 minlength: 2, 1296 }, 1297 email3: { 1298 required: true, 1299 email: true, 1300 }, 1301 message3: { 1302 required: true, 1303 minlength: 10, 1304 }, 1305 }, 1306 messages: { 1307 name3: { 1308 required: "Please specify your name", 1309 minlength: "Your name must be longer than 2 characters", 1310 }, 1311 email3: { 1312 required: "We need your email address to contact you", 1313 email: "Please enter a valid email address e.g. [email protected]", 1314 }, 1315 message3: { 1316 required: "Please enter a message", 1317 minlength: "Your message must be longer than 10 characters", 1318 }, 1319 }, 1320 errorElement: "span", 1321 highlight: function (element) { 1322 $(element).parent().removeClass("has-success").addClass("has-error"); 1323 }, 1324 success: function (element) { 1325 $(element).parent().removeClass("has-error").addClass("has-success"); 1326 }, 1327 }); 1328 } 1329 // Affix plugin 1330 //----------------------------------------------- 1331 if ($("#affix").length > 0) { 1332 $(window).load(function () { 1333 var affixBottom = 1334 $(".footer").outerHeight(true) + 1335 $(".subfooter").outerHeight(true) + 1336 $(".blogpost footer").outerHeight(true), 1337 affixTop = $("#affix").offset().top; 1338 1339 if ($(".comments").length > 0) { 1340 affixBottom = affixBottom + $(".comments").outerHeight(true); 1341 } 1342 1343 if ($(".comments-form").length > 0) { 1344 affixBottom = affixBottom + $(".comments-form").outerHeight(true); 1345 } 1346 1347 if ($(".footer-top").length > 0) { 1348 affixBottom = affixBottom + $(".footer-top").outerHeight(true); 1349 } 1350 1351 if ($(".header.fixed").length > 0) { 1352 $("#affix").affix({ 1353 offset: { 1354 top: affixTop - 150, 1355 bottom: affixBottom + 100, 1356 }, 1357 }); 1358 } else { 1359 $("#affix").affix({ 1360 offset: { 1361 top: affixTop - 35, 1362 bottom: affixBottom + 100, 1363 }, 1364 }); 1365 } 1366 }); 1367 } 1368 if ($(".affix-menu").length > 0) { 1369 setTimeout(function () { 1370 var $sideBar = $(".sidebar"); 1371 1372 $sideBar.affix({ 1373 offset: { 1374 top: function () { 1375 var offsetTop = $sideBar.offset().top; 1376 return (this.top = offsetTop - 65); 1377 }, 1378 bottom: function () { 1379 var affixBottom = 1380 $(".footer").outerHeight(true) + 1381 $(".subfooter").outerHeight(true); 1382 if ($(".footer-top").length > 0) { 1383 affixBottom = affixBottom + $(".footer-top").outerHeight(true); 1384 } 1385 return (this.bottom = affixBottom + 50); 1386 }, 1387 }, 1388 }); 1389 }, 100); 1390 } 1391 1392 //Smooth Scroll 1393 //----------------------------------------------- 1394 if ($(".smooth-scroll").length > 0) { 1395 if ($(".header.fixed").length > 0) { 1396 $( 1397 ".smooth-scroll a[href*=#]:not([href=#]), a[href*=#]:not([href=#]).smooth-scroll" 1398 ).click(function () { 1399 if ( 1400 location.pathname.replace(/^\//, "") == 1401 this.pathname.replace(/^\//, "") && 1402 location.hostname == this.hostname 1403 ) { 1404 var target = $(this.hash); 1405 target = target.length 1406 ? target 1407 : $("[name=" + this.hash.slice(1) + "]"); 1408 if (target.length) { 1409 $("html,body").animate( 1410 { 1411 scrollTop: target.offset().top - 65, 1412 }, 1413 1000 1414 ); 1415 return false;
1416 } 1417 } 1418 }); 1419 } else { 1420 $( 1421 ".smooth-scroll a[href*=#]:not([href=#]), a[href*=#]:not([href=#]).smooth-scroll" 1422 ).click(function () { 1423 if ( 1424 location.pathname.replace(/^\//, "") == 1425 this.pathname.replace(/^\//, "") && 1426 location.hostname == this.hostname 1427 ) { 1428 var target = $(this.hash); 1429 target = target.length 1430 ? target 1431 : $("[name=" + this.hash.slice(1) + "]"); 1432 if (target.length) { 1433 $("html,body").animate( 1434 { 1435 scrollTop: target.offset().top, 1436 }, 1437 1000 1438 ); 1439 return false; 1440 } 1441 } 1442 }); 1443 } 1444 } 1445 1446 //Scroll Spy 1447 //----------------------------------------------- 1448 if ($(".scrollspy").length > 0) { 1449 $("body").addClass("scroll-spy"); 1450 if ($(".fixed.header").length > 0) { 1451 $("body").scrollspy({ 1452 target: ".scrollspy", 1453 offset: 85, 1454 }); 1455 } else { 1456 $("body").scrollspy({ 1457 target: ".scrollspy", 1458 offset: 20, 1459 }); 1460 } 1461 } 1462 1463 //Video Background 1464 //----------------------------------------------- 1465 if ($(".video-background").length > 0) { 1466 if (Modernizr.touch) { 1467 $(".video-background").vide( 1468 { 1469 mp4: "videos/background-video.mp4", 1470 webm: "videos/background-video.webm", 1471 poster: "videos/video-fallback.jpg", 1472 }, 1473 { 1474 volume: 1, 1475 playbackRate: 1, 1476 muted: true, 1477 loop: true, 1478 autoplay: true, 1479 position: "50% 60%", // Similar to the CSS `background-position` property. 1480 posterType: "jpg", // Poster image type. "detect" â auto-detection; "none" â no poster; "jpg", "png", "gif",... - extensions. 1481 resizing: true, 1482 } 1483 ); 1484 } else { 1485 $(".video-background").vide( 1486 { 1487 mp4: "videos/background-video.mp4", 1488 webm: "videos/background-video.webm", 1489 poster: "videos/video-poster.jpg", 1490 }, 1491 { 1492 volume: 1, 1493 playbackRate: 1, 1494 muted: true, 1495 loop: true, 1496 autoplay: true, 1497 position: "50% 60%", // Similar to the CSS `background-position` property. 1498 posterType: "jpg", // Poster image type. "detect" â auto-detection; "none" â no poster; "jpg", "png", "gif",... - extensions. 1499 resizing: true, 1500 } 1501 ); 1502 } 1503 } 1504 //Scroll stickyCartButton 1505 //----------------------------------------------- 1506 $(window).scroll(function () { 1507 if ($(this).scrollTop() > 130) { 1508 if ($("#sticky-Cart-Count").html() != 0) { 1509 $(".stickyCartButton").fadeIn(); 1510 $(".hideStickyCartButton").hide(); 1511 } 1512 } else { 1513 $(".stickyCartButton").fadeOut(); 1514 $(".hideStickyCartButton").show(); 1515 } 1516 }); 1517 1518 //Scroll totop 1519 //----------------------------------------------- 1520 $(window).scroll(function () { 1521 if ($(this).scrollTop() != 0) { 1522 $(".scrollToTop").fadeIn(); 1523 } else { 1524 $(".scrollToTop").fadeOut(); 1525 } 1526 }); 1527 1528 $(".scrollToTop").click(function () { 1529 $("body,html").animate({ scrollTop: 0 }, 800); 1530 }); 1531 1532 //Modal 1533 //----------------------------------------------- 1534 if ($(".modal").length > 0) { 1535 $(".modal").each(function () { 1536 $(".modal").prependTo("body"); 1537 }); 1538 } 1539 1540 // Pricing tables popovers 1541 //----------------------------------------------- 1542 if ($(".pricing-tables").length > 0) { 1543 $(".plan .pt-popover").popover({ 1544 trigger: "hover", 1545 }); 1546 } 1547 // Parallax section 1548 //----------------------------------------------- 1549 if ($(".parallax").length > 0 && !Modernizr.touch) { 1550 $(".parallax").parallax("50%", 0.2, false); 1551 } 1552 if ($(".parallax-2").length > 0 && !Modernizr.touch) { 1553 $(".parallax-2").parallax("50%", 0.2, false); 1554 } 1555 if ($(".parallax-text").length > 0 && !Modernizr.touch) { 1556 $(window).scroll(function () { 1557 //Get the scoll position of the page 1558 scrollPos = $(this).scrollTop(); 1559 1560 //Scroll and fade out the banner text 1561 $(".parallax-text").css({ 1562 opacity: 1 - scrollPos / 400, 1563 }); 1564 }); 1565 } 1566 // Remove Button 1567 //----------------------------------------------- 1568 $(".btn-remove").click(function () { 1569 $(this).closest(".remove-data").remove(); 1570 }); 1571 1572 // Shipping Checkbox 1573 //----------------------------------------------- 1574 if ($("#shipping-info-check").is(":checked")) { 1575 $("#shipping-information").hide(); 1576 } 1577 $("#shipping-info-check").change(function () { 1578 if ($(this).is(":checked")) { 1579 $("#shipping-information").slideToggle(); 1580 } else { 1581 $("#shipping-information").slideToggle(); 1582 } 1583 }); 1584 1585 //This will prevent the event from bubbling up and close the dropdown when you type/click on text boxes (Header Top). 1586 //----------------------------------------------- 1587 $(".header-top .dropdown-menu input").click(function (e) { 1588 e.stopPropagation(); 1589 }); 1590 1591 // Offcanvas side navbar 1592 //----------------------------------------------- 1593 1594 if ($("#offcanvas").length > 0) { 1595 $("#offcanvas").offcanvas({ 1596 disableScrolling: false, 1597 toggle: false, 1598 }); 1599 } 1600 if ($("#offcanvas").length > 0) { 1601 $("#offcanvas [data-toggle=dropdown]").on("click", function (event) { 1602 // Avoid following the href location when clicking 1603 event.preventDefault(); 1604 // Avoid having the menu to close when clicking 1605 event.stopPropagation(); 1606 // close all the siblings 1607 $(this).parent().siblings().removeClass("open"); 1608 // close all the submenus of siblings 1609 $(this) 1610 .parent() 1611 .siblings() 1612 .find("[data-toggle=dropdown]") 1613 .parent() 1614 .removeClass("open"); 1615 // opening the one you clicked on 1616 $(this).parent().toggleClass("open"); 1617 }); 1618 } 1619 $("#boxes_co a").click(function (e) { 1620 // Prevent a page reload when a link is pressed 1621 e.preventDefault(); 1622 // Call the scroll function 1623 goToByScroll("order-form"); 1624 }); 1625 function goToByScroll(id) { 1626 // Scroll 1627 $("html,body").animate( 1628 { 1629 scrollTop: $("#" + id).offset().top - $("header").height() - 150, 1630 }, 1631 "slow" 1632 ); 1633 } 1634 1635 //Bloquegem links a continguts preparats per robots/SEO 1636 $("body").on("click", ".no-link", function (event) { 1637 event.preventDefault(); 1638 }); 1639 1640 if ($("input[name=work-with-us-file]").length) { 1641 $("input[name=work-with-us-file]").fileupload({ 1642 dropZone: $("#draganddrop"), 1643 url: $(this).data("url"), 1644 dataType: "json", 1645 done: function (e, data) { 1646 if (data.result.status == 0) { 1647 if ($("#error").length) { 1648 $("#error").remove(); 1649 $("#draganddrop").css("border-color", "#b4b4b4"); 1650 } 1651 1652 // Si encara no em posat cap fitxer, crea el div dins de #draganddrop 1653 if (!$("#dragndrop input.attached_files_input_hidden").length) { 1654 $("#draganddrop") 1655 .addClass("row") 1656 .html( 1657 '<div class="col-xs-12" id="attached-files-column"></div>' 1658 ); 1659 } 1660 1661 // Si es el primer fitxer que es penja el crea si no el substitueix 1662 if ($(".file-attached").length < 1) { 1663 $("#draganddrop #attached-files-column").append( 1664 "<p class='file-attached'><i class='fa fa-file-text-o'> </i> " + 1665 data.files[0].name + 1666 "</p>" 1667 ); 1668 } else { 1669 $(".file-attached").remove(); 1670 $(".attached_files_input_hidden").remove(); 1671 $("#draganddrop #attached-files-column").append( 1672 "<p class='file-attached'><i class='fa fa-file-text-o'> </i> " + 1673 data.files[0].name + 1674 "</p>" 1675 ); 1676 } 1677 1678 $("#dragndrop").append( 1679 '<input type="hidden" class="attached_files_input_hidden" name="attached_files_name[]" value="' + 1680 data.response().result.name + 1681 '" />' 1682 ); 1683 $("#upload-progress-bar").css("width", "0%"); 1684 console.log(data.response().result.name); 1685 } else { 1686 $("#draganddrop").css("border-color", "#a94442"); 1687 if ($("#error").length) { 1688 $("#error").remove(); 1689 } 1690 $("#draganddrop") 1691 .next() 1692 .parent() 1693 .append( 1694 '<div class="alert alert-danger danger" id="error"><i class="fa fa-times"></i> ' + 1695 data.result.error + 1696 "</div>" 1697 ); 1698 } 1699 }, 1700 progressall: function (e, data) { 1701 var progress = parseInt((data.loaded / data.total) * 100, 10); 1702 //$('#fop-progress').html(progress + '%'); 1703 $("#upload-progress-bar").css("width", progress + "%"); 1704 }, 1705 fail: function (e, data) { 1706 grecaptcha.reset(); 1707 console.log(data.jqXHR.responseText); 1708 }, 1709 }); 1710 } 1711 1712 $("body").on("click", 'p [data-toggle="pill"]', function (event) { 1713 var activeHref = $(this).attr("href"); 1714 var navtabs = $("ul.nav.nav-tabs"); 1715 navtabs.children().removeClass("active"); 1716 navtabs 1717 .find("[href='" + activeHref + "']") 1718 .parent() 1719 .addClass("active"); 1720 }); 1721 1722 $("body").on("click", ".facebook-share", function (event) { 1723 event.preventDefault(); 1724 var clean_cache_url = $(this).data("cache"); 1725 var url = $(this).attr("href"); 1726 /* 1727 $.ajax({ 1728 url: clean_cache_url, 1729 method: 'get', 1730 success: function (data) { 1731 window.open(url, '_blank'); 1732 } 1733 }); 1734 */ 1735 // Comentado el codigo que da el error, hasta que se arregle la url de data-cache en share.blade.php 1736 window.open(url, "_blank"); 1737 }); 1738 1739 var checkboxCollapseInput = $(".checkbox-collapse :checkbox"); 1740 1741 if (checkboxCollapseInput.is(":checked")) { 1742 $(".checkbox-collapse .collapse").slideDown("fast"); 1743 } 1744 1745 checkboxCollapseInput.on("click dblclick", function (evt) { 1746 if ($(this).is(":checked")) { 1747 $(".checkbox-collapse .collapse").slideDown("fast"); 1748 } else { 1749 $(".checkbox-collapse .collapse").slideUp("fast"); 1750 } 1751 }); 1752 1753 /* 1754 1755 $('[data-toggle="tooltip"]').tooltip(); 1756 1757 1758 // EVENT -> onclick copy to clipboard 1759 //Get attribute data-url from element with class .copy-clipboard and then selects and copy the text input with i
1759d equal to data-url attribute. 1760 $('body').on('click', '.copy-clipboard', function () { 1761 var id = "#" + $(this).data('url'); 1762 var copyText = $(id); 1763 copyText.select(); 1764 document.execCommand("copy"); 1765 1766 //$.notify({ 1767 // title: 'Enlace copiado al ', 1768 // message: '<strong>portapapeles</strong>' 1769 //},{ 1770 // type: 'success' 1771 //}); 1772 1773 }); 1774 1775 */ 1776 var $carousel = $('#carousel-bootstrap'); 1777 1778 // Solo si existe el carrusel 1779 if ($carousel.length) { 1780 var $items = $carousel.find('.carousel-inner .item'); 1781 var $thumbnails = $('.carousel-thumbnails .thumbnail'); 1782 1783 // Función para activar slide 1784 function activateSlide(index) { 1785 $items.removeClass('active').eq(index).addClass('active'); 1786 $thumbnails.removeClass('active').eq(index).addClass('active'); 1787 } 1788 1789 // Eventos hover y click 1790 $thumbnails.each(function () { 1791 var $thumb = $(this); 1792 var index = parseInt($thumb.attr('data-slide-to')); 1793 1794 $thumb.on('mouseenter click', function (e) { 1795 e.preventDefault(); 1796 activateSlide(index); 1797 }); 1798 }); 1799 } 1800 1801 1802 1803 }); // End document ready 1804})(this.jQuery); 1805 1806if (jQuery(".btn-print").length > 0) { 1807 function print_window() { 1808 var mywindow = window; 1809 mywindow.document.close(); 1810 mywindow.focus(); 1811 mywindow.print(); 1812 mywindow.close(); 1813 } 1814} 1815 1816const buttons = document.querySelectorAll("[data-carousel-button]"); 1817 1818buttons.forEach((button) => { 1819 button.addEventListener("click", () => { 1820 const offset = button.dataset.carouselButton === "next" ? 1 : -1; 1821 const slides = button 1822 .closest("[data-carousel]") 1823 .querySelector("[data-slides]"); 1824 1825 const activeSlide = slides.querySelector("[data-active]"); 1826 let newIndex = [...slides.children].indexOf(activeSlide) + offset; 1827 if (newIndex < 0) newIndex = slides.children.length - 1; 1828 if (newIndex >= slides.children.length) newIndex = 0; 1829 1830 slides.children[newIndex].dataset.active = true; 1831 delete activeSlide.dataset.active; 1832 }); 1833}); 1834 1835//# sourceMappingURL=idea.js.map
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.