Can anyone help, please - it would be much appreciated?
On the Tabs widget, I wanted the tabs to change on hover. I have successfully done this using the usual javascript (I have displayed the JS on the shared link))
I also have a counterUp Javascript used to animate numbers counting up from 0 to the desired amount i.e 0-100 (I have displayed this JS the shared link)
When I add this javascript for the counter, it cancels out the Tab Hover javascript. The only way around this is to have the two separate javascript on different pages. However, I need to have both the Tabs Hover javascript and the counterUp javascript on the same page.
Would anyone care to offer any creative solutions?
I have assumed there is a simple workaround, but as I am not the best coder, I am reaching out to the very clever people on here.
I will also be happy to pay you with a virtual coffee.
Try using CounterUp2 - paste all this into Page Settings > Custom Code > Footer Code:
<script src="https://unpkg.com/counterup2@2.0.2/dist/index.js"></script>
<script>
const counterUp = window.counterUp.default
const el = document.querySelector( '.counter' )
// Start counting, typically you need to call this when the
// element becomes visible, or whenever you like.
counterUp( el, {
duration: 1000,
delay: 10,
} )
$('.counter').addClass('animated fadeInDownBig');
</script>
<script>
$('.tab-link').hover(
function() {
$( this ).click();
}
);
</script>
You’ll just need to add a text element with class ‘counter’ - test by adding a <p> with text “1000000”
You nearly got there. I added the new counterup 2 but it only animates one text-block with the CSS ‘counter’. The other text-blocks that also have the CSS ‘counter’ do not animate BUT it does keep the hover-over tabs map working.
I just need to work out why the other text-blocks with ‘counter’ on the CSS do not animate even though they have ‘counter’ as their CSS property.
And here’s the code you can drop into the before page settings in Webflow.
<script src="https://unpkg.com/counterup2@2.0.2/dist/index.js"></script>
<script>
const counterUp = window.counterUp.default
const elements = document.querySelectorAll( '.counter' )
// Start counting, typically you need to call this when the
// element becomes visible, or whenever you like.
elements.forEach((el) => {
counterUp( el, {
duration: 1000,
delay: 10,
} )
})
$('.counter').addClass('animated fadeInDownBig');
</script>
<script>
$('.tab-link').hover(
function() {
$( this ).click();
}
);
</script>
That’s the baby. Fully working (not sure how to mark it as the solution).
Hey guys, you both helped me immensely. @mww you were so nearly there but honestly, you built 99% of it for @learyjk who tied the knots - the video you did was beyond the call of duty. Both of you thank you! If you drop me a pm and tell me the best way to buy you a virtual coffee I will do so - post haste.