Jump to content

Recommended Posts

Posted (edited)

Afternoon All,

 

Im trying to get something like the below but in HTML not Javascript:

 

https://inorganik.github.io/countUp.js/

 

Same size even same colour will do... Can anyone point me to where I could find the code online? As im not really a coder and by the looks of my google searches I'm not doing well online either!

Edited by RichB
Posted
That one uses JavaScript as well. I have two suggestions. You could try putting the JavaScript inside script tags in the head of the HTML page, as opposed to linking to a separate file. Alternatively you could make an animated gif of what you want and insert it as an image.
  • Thanks 1
Posted

You can embed javascript in Wix unless they changed it, don't think they support it but they can :p

 

You just need to use inline javascript rather than a separate file etc

 

Doesn't something like this within the wix htmlapp work?

 

Test
<br />
document.getElementById('click_me').addEventListener("click", function(event) {<br />
    (function(event) {<br />
        alert("test");<br />
    }).call(document.getElementById('click_me'), event);<br />
});<br />

 

Steve

  • Thanks 1
Posted

@Steve21 That code does work!

 

However this countdown one doesn't? any suggestions as to why? Knew I should have learnt code in the years as a NM...

 

ar options = {

  useEasing: true,

  useGrouping: true,

  separator: ',',

  decimal: '.',

};

var demo = new CountUp('myTargetElement', 0, 4165, 0, 2.5, options);

if (!demo.error) {

  demo.start();

} else {

  console.error(demo.error);

}

 

From - https://inorganik.github.io/countUp.js/

Posted
Certainly not elegant, and in Chrome seems to ignore the 0.5s between switches so it just goes straight to 10! Ultimately to achieve a countdown/up/most animation in the users browser without them refreshing the page you will have to use Javascript unless you want to do something from 10-15 years ago involving barely-supported Flash or cunningly timed animated gifs. Neither of which I would recommend even contemplating.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...