PageSourceSearch

https://solargroup.com/js/custom.js

js solargroup.com collected 2026-10-02 10:47:30 UTC 17,959 bytes, 786 lines download raw bytes

1// page Load Jquery
2
3
4
5
6gsap.registerPlugin(ScrollTrigger);
7AOS.init({
8  duration: 800,
9  once: true
10});
11Splitting();
12
13
14
15
16// function Particle( x, y, radius ) {
17//   this.init( x, y, radius );
18// }
19
20// Particle.prototype = {
21
22//   init: function( x, y, radius ) {
23
24//     this.alive = true;
25
26//     this.radius = radius || 10;
27//     this.wander = 0.15;
28//     this.theta = random( TWO_PI );
29//     this.drag = 0.92;
30//     this.color = '#fff';
31
32//     this.x = x || 0.0;
33//     this.y = y || 0.0;
34
35//     this.vx = 0.0;
36//     this.vy = 0.0;
37//   },
38
39//   move: function() {
40
41//     this.x += this.vx;
42//     this.y += this.vy;
43
44//     this.vx *= this.drag;
45//     this.vy *= this.drag;
46
47//     this.theta += random( -0.5, 0.5 ) * this.wander;
48//     this.vx += sin( this.theta ) * 0.1;
49//     this.vy += cos( this.theta ) * 0.1;
50
51//     this.radius *= 0.96;
52//     this.alive = this.radius > 0.5;
53//   },
54
55//   draw: function( ctx ) {
56
57//     ctx.beginPath();
58//     ctx.arc( this.x, this.y, this.radius, 0, TWO_PI );
59//     ctx.fillStyle = this.color;
60//     ctx.fill();
61//   }
62// };
63
64
65
66
67
68var prevScrollpos = window.pageYOffset;
69var navHeight = $('.header').height();
70
71$(window).scroll(function () {
72  var scroll = $(window).scrollTop();
73  //>=, not <=
74  if (scroll >= navHeight + 30) {
75    $(".header").addClass("scrollUp");
76  } else {
77    $(".header").removeClass("scrollUp");
78  }
79});
80
81window.onscroll = function () {
82  var currentScrollPos = window.pageYOffset;
83  if (prevScrollpos > currentScrollPos) {
84    document.getElementById("header").style.top = "0";
85  } else {
86    document.getElementById("header").style.top = - navHeight - 5 + "px";
87  }
88  prevScrollpos = currentScrollPos;
89}
90
91// home slider
92var swiper = new Swiper(".home-swiper", {
93  grabCursor: true,
94  // effect: 'coverflow',
95  effect: 'fade',
96  crossFade: true,
97  speed: 1200,
98  slideShadows: true,
99  coverflowEffect: {
100    rotate: 0,
101    stretch: 0,
102    depth: 500,
103    modifier: 1,
104    slideShadows: true,
105    scale: 0.5,
106  },
107  autoplay: {
108    delay: 4500,
109    disableOnInteraction: false,
110  },
111  // pagination: {
112  //   el: '.pagi-home',
113  //   clickable: true,
114  // },
115  // navigation: {
116  //   nextEl: '.home-next',
117  //   prevEl: '.home-prev',
118  // },
119});
120
121// number swiper
122var swiper = new Swiper(".number-swiper", {
123  slidesPerView: 2,
124  spaceBetween: 20,
125  grabCursor: true,
126  speed: 1500,
127  autoplay: {
128    delay: 2500,
129    disableOnInteraction: false,
130  },
131  navigation: {
132    nextEl: ".slide-button-next",
133    prevEl: ".slide-button-prev",
134  },
135  scrollbar: {
136    el: ".number-scrollbar",
137  },
138  breakpoints: {
139    640: {
140      slidesPerView: 2,
141      spaceBetween: 20,
142    },
143    768: {
144      slidesPerView: 3,
145      spaceBetween: 30,
146    },
147    1024: {
148      slidesPerView: 4,
149      spaceBetween: 30,
150    },
151  },
152});
153
154var swiper = new Swiper(".dispatch-swiper", {
155  slidesPerView: 1,
156  spaceBetween: 20,
157  grabCursor: true,
158  autoplay: {
159    delay: 2500,
160    disableOnInteraction: false,
161  },
162  navigation: {
163    nextEl: ".slide-button-next",
164    prevEl: ".slide-button-prev",
165  },
166  scrollbar: {
167    el: ".number-scrollbar",
168  },
169  breakpoints: {
170    640: {
171      slidesPerView: 1,
172      spaceBetween: 20,
173    },
174    768: {
175      slidesPerView: 3,
176      spaceBetween: 30,
177    },
178    1024: {
179      slidesPerView: 3,
180      spaceBetween: 30,
181    },
182  },
183});
184
185var swiper = new Swiper(".about-swiper", {
186  effect: "coverflow",
187  grabCursor: true,
188  centeredSlides: true,
189  coverflowEffect: {
190    rotate: 0,
191    stretch: 0,
192    depth: 100,
193    modifier: 4,
194    slideShadows: true
195  },
196  loop: true,
197  // Navigation arrows
198  navigation: {
199    nextEl: ".swiper-button-next",
200    prevEl: ".swiper-button-prev"
201  },
202  keyboard: {
203    enabled: true
204  },
205  mousewheel: {
206    thresholdDelta: 70
207  },
208  breakpoints: {
209    560: {
210      slidesPerView: 2.5
211    },
212    768: {
213      slidesPerView: 3
214    },
215    1024: {
216      slidesPerView: 3
217    }
218  }
219});
220
221var counted = 0;
222$(window).scroll(function () {
223
224  var oTop = $('#counter').offset().top - window.innerHeight;
225  if (counted == 0 && $(window).scrollTop() > oTop) {
226    $('.count').each(function () {
227      var $this = $(this),
228        countTo = $this.attr('data-count');
229      $({
230        countNum: $this.text()
231      }).animate({
232        countNum: countTo
233      },
234
235        {
236
237          duration: 2000,
238          easing: 'swing',
239          step: function () {
240            $this.text(Math.floor(this.countNum));
241          },
242          complete: function () {
243            $this.text(this.countNum);
244            //alert('finished');
245          }
246
247        });
248    });
249    counted = 1;
250  }
251
252});
253
254
255var swiper = new Swiper(".people-swiper", {
256  slidesPerView: 1,
257  spaceBetween: 20,
258  grabCursor: true,
259  // autoplay: {
260  //   delay: 2500,
261  //   disableOnInteraction: false,
262  // },
263  navigation: {
264    nextEl: ".slide-button-next",
265    prevEl: ".slide-button-prev",
266  },
267  scrollbar: {
268    el: ".number-scrollbar",
269  },
270  breakpoints: {
271    640: {
272      slidesPerView: 1,
273      spaceBetween: 20,
274    },
275    768: {
276      slidesPerView: 3,
277      spaceBetween: 30,
278    },
279    1024: {
280      slidesPerView: 3,
281      spaceBetween: 30,
282    },
283  },
284});
285
286var swiper = new Swiper(".awards-swiper", {
287  // direction: 'vertical',
288  // mousewheelControl: true,
289  // slidesPerView: 1,
290  spaceBetween: 20,
291  autoplay: {
292    delay: 2500,
293    disableOnInteraction: false,
294  },
295  navigation: {
296    nextEl: ".swiper-button-next",
297    prevEl: ".swiper-button-prev",
298  },
299});
300
301
302
303
304var swiper = new Swiper(".news-swiper", {
305  slidesPerView: 1,
306  spaceBetween: 30,
307  loop: true,
308  pagination: {
309    el: ".swiper-pagination",
310    clickable: true,
311  },
312  // autoplay: {
313  //   delay: 2500,
314  //   disableOnInteraction: false,
315  // },
316  scrollbar: {
317    el: ".number-scrollbar",
318  },
319  breakpoints: {
320    640: {
321      slidesPerView: 1,
322      spaceBetween: 20,
323    },
324    768: {
325      slidesPerView: 1,
326      spaceBetween: 30,
327    },
328    1024: {
329      slidesPerView: 3,
330      spaceBetween: 30,
331    },
332  },
333});
334
335var swiper = new Swiper(".investor-swiper", {
336  slidesPerView: 1,
337  spaceBetween: 30,
338  loop: true,
339  pagination: {
340    el: ".swiper-pagination",
341    clickable: true,
342  },
343  // autoplay: {
344  //   delay: 2500,
345  //   disableOnInteraction: false,
346  // },
347  scrollbar: {
348    el: ".number-scrollbar",
349  },
350  breakpoints: {
351    640: {
352      slidesPerView: 1,
353      spaceBetween: 20,
354    },
355    768: {
356      slidesPerView: 1,
357      spaceBetween: 30,
358    },
359    1024: {
360      slidesPerView: 3,
361      spaceBetween: 30,
362    },
363  },
364});
365
366var swiper = new Swiper(".media-swiper", {
367  slidesPerView: 1,
368  spaceBetween: 0,
369  loop: true,
370  pagination: {
371    el: ".swiper-pagination",
372    clickable: true,
373  },
374  autoplay: {
375    delay: 2500,
376    disableOnInteraction: false,
377  },
378  scrollbar: {
379    el: ".number-scrollbar",
380  },
381  breakpoints: {
382    640: {
383      slidesPerView: 1,
384      spaceBetween: 20,
385    },
386    768: {
387      slidesPerView: 1,
388      spaceBetween: 30,
389    },
390    1024: {
391      slidesPerView: 3,
392      spaceBetween: 30,
393    },
394  },
395});
396
397
398// Preloader
399(function ($) {
400
401  //mySplitText = new splitText(".splittext", {type:"words,chars"});
402  gsap.set(".splittext", { perspective: 400 });
403  //chars = mySplitText.chars;
404
405
406  var perfData = window.performance.timing,
407    EstimatedTime = -(perfData.loadEventEnd - perfData.navigationStart),
408    time = parseInt((EstimatedTime / 1000) % 60, 10) * 100;
409
410  var PercentageID = $("#percentage"),
411    LoaderID = $("#loading-bar span"),
412    revealID = $("#logo-overlay"),
413    start = 0,
414    end = 100,
415    duration = time;
416  animateValue(PercentageID, LoaderID, revealID, start, end, duration);
417
418  function animateValue(id, lid, rid, start, end, duration) {
419    var range = end - start,
420      current = start,
421      increment = end > start ? 1 : -1,
422      stepTime = Math.abs(Math.floor(duration / range)),
423      obj = $(id);
424    objLoader = $(lid);
425    objReveal = $(rid);
426
427    var timer = setInterval(function () {
428      current += increment;
429      $(obj).text(Math.floor(current / 4));
430      $(objLoader).css("width", current + "%");
431      $(objReveal).css("top", -current + "px");
432
433      if (current == end) {
434        clearInterval(timer);
435
436        gsap.from('.giant-text', {
437          duration: 0.5,
438          opacity: 0,
439          y: 30,
440          delay: 1.5
441        });
442        gsap.from('.img-girl', {
443          duration: 0.8,
444          opacity: 0,
445          x: -30,
446          delay: 2
447        });
448
449        gsap.from('#standing', {
450          duration: 0.5,
451          opacity: 0,
452          delay: 2
453        });
454
455        gsap.from('.banner-logo', {
456          duration: 0.5,
457          opacity: 0,
458          y: -30,
459          delay: 3
460        });
461
462        gsap.from('.red-box', {
463          duration: 1.2,
464          opacity: 0,
465          y: 80,
466          ease: "back",
467          delay: 2
468        }
469        );
470
471
472
473
474
475        // gsap intro
476        // gsap.from('.navbar-brand',{opacity:0, y: 30,duration: 0.5, delay: 1.5});
477        // gsap.from('.navbar-nav>li', {opacity:0, y: 30, ease: "power3.out", duration: 0.8, delay: 1.5, stagger: 0.1});
478        // gsap.from("#banner-intro", {opacity:0, y: 30, ease: "back", duration: 1, delay: 2});
479
480      }
481    }, stepTime);
482  }
483
484  setInterval(function () {
485    $("body").addClass("page-loaded");
486  }, time);
487
488
489})(jQuery);
490
491
492
493
494
495
496
497// gsap.to('#footerLogoBig', {
498//   scrollTrigger: {
499//     trigger: '#footer',
500//     start:'top center',
501//     end:'top center',
502//     //markers: true,
503//     scrub: 1
504//   },
505//   y: 200
506// });
507
508
509
510
511
512
513
514
515
516
517
518
519//Show more and less
520$(".show-more").click(function () {
521  if ($(".text").hasClass("show-more-height")) {
522    $(this).text("...Show Less");
523  } else {
524    $(this).text("...Show More");
525  }
526
527  $(".text").toggleClass("show-more-height");
528});
529
530
531// SVG DRAW JS START***********
532
533let wrapper = document.querySelector('.svg-draw-wrapper');
534let paths = document.querySelectorAll('.stroke-path');
535
536// Function to calculate path lengths
537function calculatePathLengths() {
538    paths.forEach(path => {
539        let pathLength = path.getTotalLength();
540        path.style.strokeDasharray = pathLength + ' ' + pathLength;
541        path.style.strokeDashoffset = pathLength;
542    });
543}
544
545// Recalculate path lengths when the window is loaded or resized
546window.addEventListener('load', calculatePathLengths);
547window.addEventListener('resize', calculatePathLengths);
548
549// Update stroke dash offset on scroll
550window.addEventListener("scroll", (e) => {
551    paths.forEach(path => {
552        let scrollPercentage = (document.documentElement.scrollTop + wrapper.scrollTop) / (document.documentElement.scrollHeight - document.documentElement.clientHeight);
553        let drawLength = path.getTotalLength() * scrollPercentage * 3.5;
554        path.style.strokeDashoffset = path.getTotalLength() - drawLength;
555
556        if (scrollPercentage >= 0.99) {
557            path.style.strokeDasharray = 'none';
558        } else {
559            path.style.strokeDasharray = path.getTotalLength() + ' ' + path.getTotalLength();
560        }
561    });
562});
563
564// SVG DRAW JS END***********
565
566document.addEventListener("DOMContentLoaded", function () {
567  var rotatingTexts = document.querySelectorAll('.rotating-text-wrapper p');
568  var currentIndex = 0;
569  var intervalDuration = 5000; // Change this value to adjust the duration between each text animation
570
571  // Show the first text initially
572  rotatingTexts[currentIndex].style.display = 'block';
573
574  function toggleText() {
575      rotatingTexts[currentIndex].style.display = 'none';
576      currentIndex = (currentIndex + 1) % rotatingTexts.length;
577      rotatingTexts[currentIndex].style.display = 'block';
578  }
579
580  setInterval(toggleText, intervalDuration);
581});
582
583
584// SVG DRAW 2 JS START***********
585window.addEventListener('scroll', function() {
586  const svg = document.querySelector('.stroke-path2');
587  const pathLength = svg.getTotalLength();
588  
589  // Calculate scroll percentage, ensuring it's between 0 and 1
590  let scrollPercentage = window.scrollY / (document.body.scrollHeight - window.innerHeight);
591  scrollPercentage = Math.min(Math.max(scrollPercentage, 0), 1);
592  
593  // Adjust the speed factor as needed (higher value for faster drawing)
594  const speedFactor = 9;
595  const drawLength = pathLength * scrollPercentage * speedFactor;
596
597  svg.style.strokeDasharray = pathLength;
598  svg.style.strokeDashoffset = pathLength - drawLength;
599});
600
601// SVG DRAW 2 JS END***********
602
603
604// Chakra Video Play - Pause JS Start************
605  let options = {
606     root: null,
607     rootMargin: '0px',
608     threshold: 0.5,
609  };
610  let callback = (entries , observer) => {
611    entries.forEach(entry => {
612      if(entry.target.id == 'chakraCompVideo'){
613        if(entry.isIntersecting){
614          entry.target.play();
615          console.log("****Video is playing*****");
616        }
617        else{
618          entry.target.pause();
619          console.log("****Video is paused*****");
620
621        }
622      }
623  });
624  }
625  let observer = new IntersectionObserver(callback , options);
626  observer.observe(document.querySelector('#chakraCompVideo')); 
627// Chakra Video Play - Pause JS JS End***********
628
629// NEW WORLD MAP JS START
630document.addEventListener("DOMContentLoaded", function() {
631  const showDotsButton = document.getElementById("unique-map-2");
632  const showStatesButton = document.getElementById("unique-map-3");
633  const showAllDotsButton = document.getElementById("unique-map-1");
634  const dots = document.querySelectorAll(".about-map");
635  const mapImg = document.querySelector(".map-img");
636  const worldMapContainer = document.getElementsByClassName('world-map')[0];
637
638  // Show the default map data for unique-map-1 on page load
639  showAllDots();
640  changeMapImage("./img/wold-mapx.svg");
641
642  showDotsButton.addEventListener("click", function() {
643    hideDotsBetween16And42(); // Hide dots between tool-16 to tool-42
644    const specificToolNumbers = [9, 10, 11, 12, 116, 14, 15, 48, 53];
645showSpecificDots(specificToolNumbers);
646
647    changeMapImage("./img/wold-mapx.svg");
648  });
649
650  showStatesButton.addEventListener("click", function() {
651    showIndiaDots();
652    changeMapImage("./img/india_map.svg");
653  });
654
655  showAllDotsButton.addEventListener("click", function() {
656    showAllDots();
657    changeMapImage("./img/wold-mapx.svg");
658  });
659
660  function hideDotsBetween16And42() {
661    dots.forEach(dot => {
662      const className = dot.classList[0];
663      const toolNumber = parseInt(className.split('-')[1]);
664      if (toolNumber >= 16 && toolNumber <= 42) {
665        dot.classList.remove('show');
666        setTimeout(() => {
667          dot.style.display = 'none';
668        }, 400); // Match this duration with the CSS transition duration
669      }
670    });
671  }
672
673  function showSpecificDots(toolNumbers) {
674    dots.forEach(dot => {
675      const className = dot.classList[0];
676      const toolNumber = parseInt(className.split('-')[1]);
677      
678      if (toolNumbers.includes(toolNumber)) {
679        // Show the dot
680        dot.style.display = 'block';
681        setTimeout(() => {
682          dot.classList.add('show');
683        }, 10); // Slight delay for animation
684      } else {
685        // Hide the dot
686        dot.classList.remove('show');
687        setTimeout(() => {
688          dot.style.display = 'none';
689        }, 400);
690      }
691    });
692  }
693  
694
695  function showIndiaDots() {
696    dots.forEach(dot => {
697      const className = dot.classList[0];
698      const toolNumber = parseInt(className.split('-')[1]);
699      if (toolNumber >= 16 && toolNumber <= 42) {
700        dot.style.display = 'block';
701        setTimeout(() => {
702          dot.classList.add('show');
703        }, 10);
704      } else {
705        dot.classList.remove('show');
706        setTimeout(() => {
707          dot.style.display = 'none';
708        }, 400);
709      }
710    });
711  }
712
713  function showAllDots() {
714    dots.forEach(dot => {
715      // Check if the current dot is not '.tool-11'
716      if (!dot.classList.contains('tool-11')) {
717        dot.style.display = 'block';
718        setTimeout(() => {
719          dot.classList.add('show');
720        }, 10);
721      }
722    });
723    hideDotsBetween16And42();
724  }
725  
726
727  function changeMapImage(imageSrc) {
728    worldMapContainer.classList.add('fade-out');
729
730    setTimeout(() => {
731      mapImg.src = imageSrc;
732
733      if (imageSrc.includes("india_map.svg")) {
734        worldMapContainer.style.width = '45vw';
735        worldMapContainer.style.height = 'auto';
736      } else {
737        // Reset size for other images
738        worldMapContainer.style.width = '100%';
739        worldMapContainer.style.height = 'auto';
740      }
741
742      worldMapContainer.classList.remove('fade-out');
743      worldMapContainer.classList.add('fade-in');
744    }, 500); // Match this duration with the CSS transition duration
745
746    // Remove fade-in class after animation completes to reset state
747    setTimeout(() => {
748      worldMapContainer.classList.remove('fade-in');
749    }, 1000); // Duration longer than CSS transition to ensure it's fully visible
750  }
751});
752
753// NEW WORLD MAP JS END
754
755
756document.addEventListener('DOMContentLoaded', function() {
757  var swiper = new Swiper('.swiper-container', {
758    slidesPerView: 'auto', // Number of slides per view, or 'auto' to fit as many as possible
759    spaceBetween: 15, // Gap between slides
760    loop: true, // Enable looping
761    autoplay: {
762      delay: 5000, // Autoplay delay in milliseconds (5 seconds in this case)
763      disableOnInteraction: false, // Autoplay continues after user interactions (like touch)
764    },
765    pagination: {
766      el: '.swiper-pagination', // Pagination container
767      clickable: true, // Enable clickable pagination bullets
768    },
769    navigation: {
770      nextEl: '.swiper-button-next', // Default next button
771      prevEl: '.swiper-button-prev', // Default prev button
772    },
773    breakpoints: {
774      // Responsive breakpoints
775      992: {
776        slidesPerView: 3, // Three slides per view on desktop
777      },
778      768: {
779        slidesPerView: 2, // Two slides per view on tablet
780      },
781      480: {
782        slidesPerView: 1, // One slide per view on mobile
783      }
784    }
785  });
786});

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.