Skip to content

Commit

Permalink
Testimonial Slider and Counter Integration to main script (#31)
Browse files Browse the repository at this point in the history
* Hero Counter additon and update to main script file.

* Updated gap on Proof Splide

* Updated Gap

* Update to main script
  • Loading branch information
Rework-Digital authored Oct 23, 2024
1 parent 1f9b5a6 commit e005351
Showing 1 changed file with 45 additions and 11 deletions.
56 changes: 45 additions & 11 deletions assets/js/solcast.webflow.script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,13 @@ document.addEventListener('DOMContentLoaded', () => {
new Splide('.splide', {
type: 'loop',
drag: 'free',
gap: '5rem',
gap: '2rem',
autoWidth: true,
pauseOnHover: true,
pauseOnFocus: true,
autoScroll: {
speed: 0.8,
},
breakpoints: {
760: {
gap: '3rem',
},
580: {
gap: '2rem',
},
},
reducedMotion: {
speed: 0,
autoplay: 'pause',
Expand Down Expand Up @@ -168,7 +160,7 @@ $(".slider-main_component").each(function (index) {
},
keyboard: {
enabled: true,
onlyInViewport: true
onlyInViewport: true,
},
breakpoints: {
// mobile landscape
Expand All @@ -193,4 +185,46 @@ $(".slider-main_component").each(function (index) {
disabledClass: "is-disabled"
},
});
});
});

/*--------------------------*/
/* Hight Light Text Script */
/*--------------------------*/

document.addEventListener('DOMContentLoaded', function() {
// Select all elements with the class 'script-text-highlight'
var elements = document.querySelectorAll('.script-text-highlight');

// Loop through each element and apply the text replacement
elements.forEach(function(element) {
// Use a regular expression to find the ## content ##
var elementText = element.innerHTML;
var newText = elementText.replace(/##(.*?)##/g, '<span class="highlight">$1</span>');

// Update the element with the new content
element.innerHTML = newText;
});
});

/*------------------------------------------*/
/* Counter Script for Page Banner Component */
/*------------------------------------------*/

// Select all the paragraphs with the class 'stat-card_heading'
const paragraphs = document.querySelectorAll('.stat-card_heading');

// Regular expression to match number sets in each paragraph
const regex = /\d+/g;

// Loop through each element and apply the transformation
paragraphs.forEach(function(paragraph) {
// Replace each number with the span element
paragraph.innerHTML = paragraph.innerHTML.replace(regex, function(match) {
// Format the number with commas using toLocaleString
const formattedNumber = Number(match).toLocaleString();

return `<span data-purecounter-start="0" data-purecounter-end="${match}" data-purecounter-separator="true" class="purecounter">${formattedNumber}</span>`;
});
});

new PureCounter();

0 comments on commit e005351

Please sign in to comment.