'OnClick' function not running on first click, a second click is required

'OnClick' function not running on first click, a second click is required

So, I have a pair of elements that have an onClick function known as timeline1(). However, the script does not run when the div is clicked the first time, yet runs fine after an additional click. Below is the HTML code:

So, I have a pair of elements that have an onClick function known as timeline1(). However, the script does not run when the div is clicked the first time, yet runs fine after an additional click. Below is the HTML code:

<div class="Section_Timeline_Bullet">
            <div class="Section_Timeline_Bullet_Connector"></div>
            <img src="images/RightArrow.png" id="RightArrow1" onclick="timeline1()">
            <div class="Section_Timeline_Bullet_Info" id="Info1" onclick="timeline1()">12/02/2019</div>
        </div>

and this is the corresponding Javascript function that should be running from the first click:

function timeline1() {
var arrow1 = document.getElementById('RightArrow1');
var info1 = document.getElementById('Info1');

if (info1.style.height == "5vh") { arrow1.classList.add("Section_Timeline_Rotated_Image_Up"); arrow1.style.transition = "all 0.5s ease"; arrow1.style.left = "-0.65vw"; info1.style.top = "-42vh"; info1.style.height = "20vh"; info1.style.transition = "all 0.5s ease"; } else { arrow1.classList.remove("Section_Timeline_Rotated_Image_Up"); arrow1.style.transition = "0"; arrow1.style.left = "-0.5vw"; info1.style.height = "5vh"; info1.style.top = "-27vh"; info1.style.transition = "0"; }

}

The only thing that the arrow1.classList.add("Section_Timeline_Rotated_Image_Up); part does is rotate the image, which still does not run on the first click of the div as well. Any help as to why the function doesn't run on the first click, but does on the second would be appreciated.

TL;DR: Clicking on element doesn't run its onClick the first time, but clicking again runs it fine... Help D:

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

How to Create an Animated Navbar with Html, CSS and JavaScript

In this Html, CSS and JavaScript tutorial you will build an animated navbar with Html, CSS and JavaScript. Have you every wanted to create an awesome animated navbar with JavaScript? We will be looking at making a navbar with Html and CSS and then using the intersection observer in JavaScript to help us create this effect.

How to Create Attendance Register in JavaScript, CSS, and HTML

How to Create Attendance Register in JavaScript, CSS, and HTML. The tutorial includes the use of JavaScript functions, image, Table, Option, input, and other components.

TIP Calculator using HTML, CSS & Javascript

We take a deep dive into how to code a tip calculator using HTML, CSS & Javascript. This tutorial can be considered as a beginner tutorial. We look into form inputs, styling form inputs in CSS & HTML while using Javascript to create the interactivity needed to calculate tips.