Javascript Calculator Issues [CLOSED]

Javascript Calculator Issues [CLOSED]
0

#1

Hey Guys,

I have just started working on the Calculator project and some issues have arised.

I have created an animation to the underscore that keeps showing and hiding to indicate that the user’s calculations should be displayed there, but:
1- How can I put the expression before the underscore?
2- I don’t want the exp. to inherit the underscore animation (I just want the underscore to have the animation)?

Would you help me? :sweat_smile:


Here’s the HTML:

<div id="screenZone">
      <div id="calculations" class="underscore">_</div>
      <div id="result">0</div>
</div>

and this is the js that I have written, till now:

const calcs = document.getElementById("calculations");
function addToScreenZone(x) {
  calcs.textContent += x;
}

Simon


#2
<div id="calculations" class="underscore"></div>
.underscore {
  float: left;
  margin: 0.1rem 0 0 0.5rem;
  font-size: 1.08rem;
}
.underscore:after{
  content:'_';
  animation: underscore infinite 1.2s step-end;  
}

#3

Great!
Thank you very much @pseudop! :+1: