₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,324,997 members, 8,419,863 topics. Date: Thursday, 04 June 2026 at 04:18 AM

Toggle theme

I Am Learning Javascript, I Need Help With The Code I'm Writing - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingI Am Learning Javascript, I Need Help With The Code I'm Writing (782 Views)

1 Reply (Go Down)

I Am Learning Javascript, I Need Help With The Code I'm Writing by ugom123(op): 8:24am On Mar 14, 2021
Any help here please, will really appreciate. Been on this for more than 15 hours huh

I have written and animated two images and text tags using Css keyframe animation.

So, I want to be able to control these same animations using Javascript via two buttons I already created. I have researched and researched, can't solve this logic.

The animation I did via css keyframe happened this way:

When you load the page, the first image slide in from left, stayed for few seconds and slide out via left and the second image slide in and remained on the page. The texts tags animated for each of the images.

Now, I want to be able to use the buttons to slide the images in and out after the css animations have completed. Help me, pls if you can. Thanks
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by stanliwise(m): 8:31am On Mar 14, 2021
ugom123:
Any help here please, will really appreciate. Been on this for more than 15 hours huh

I have written and animated two images and text tags using Css keyframe animation.

So, I want to be able to control these same animations using Javascript via two buttons I already created. I have researched and researched, can't solve this logic.

The animation I did via css keyframe happened this way:

When you load the page, the first image slide in from left, stayed for few seconds and slide out via left and the second image slide in and remained on the page. The texts tags animated for each of the images.

Now, I want to be able to use the buttons to slide the images in and out after the css animations have completed. Help me, pls if you can. Thanks
You’re talking of event. Attach an event listener to the button.

Create a function to do what you want,
Create an event listener

So your codes go like this

function doTheAmination(){
}


myButton.onclick => should call doTheAnimation
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by ugom123(op): 8:51am On Mar 14, 2021
stanliwise:
You’re talking of event. Attach an event listener to the button.

Create a function to do what you want,
Create an event listener

So your codes go like this

function doTheAmination(){
}


myButton.onclick => should call doTheAnimation
Thank you brotherly.so grateful that someone showed interest to help me. Pls, can I add you on WhatsApp?
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by Karleb(m): 9:06am On Mar 14, 2021
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by stanliwise(m): 9:07am On Mar 14, 2021
ugom123:
Thank you brotherly.so grateful that someone showed interest to help me. Pls, can I add you on WhatsApp?
0 eight 1 72 eight 3 three zero 7 3
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by ugom123(op): 9:13am On Mar 14, 2021
stanliwise:
0 eight 1 72 eight 3 three zero 7 3
Thank you so much bro.
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by ahmedsaniadamu(m): 11:21pm On Mar 14, 2021
it's some times very hard to control CSS animation using JavaScript I prefer coding the animation itself using JavaScript timing event called setInterval (); with this event you can easily set control and manipulate HTML elements
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by ugom123(op): 8:41am On Mar 19, 2021
ahmedsaniadamu:
it's some times very hard to control CSS animation using JavaScript I prefer coding the animation itself using JavaScript timing event called setInterval (); with this event you can easily set control and manipulate HTML elements
You have a point. I have noticed that it is hard to really control CSS animations especially, the keyframe ones. I have given up and will try and animate using javascript and set transition in css.
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by Qsand: 4:56am On Mar 20, 2021
stanliwise:
You’re talking of event. Attach an event listener to the button.
Create a function to do what you want, Create an event listener
So your codes go like this
function doTheAmination(){ }

myButton.onclick => should call doTheAnimation
Does anyone still use on click... Shouldn't it be
myButton.addeventlistener ('click', doTheAnimation)
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by stanliwise(m): 10:40am On Mar 20, 2021
Qsand:
Does anyone still use on click... Shouldn't it be

myButton.addeventlistener ('click', doTheAnimation)
Everything is a semantic perhaps I was writing a pseudo code
Re: I Am Learning Javascript, I Need Help With The Code I'm Writing by bularuz(m): 11:05am On Mar 20, 2021
Is there anyone that can teach angular or vue
1 Reply

I Find It Hard Learning Javascript...i Need HelpHow To Go About Learning Javascript Within Two WeeksDifficulties Learning Javascript? This Will Change Your Life!234

Please Can Someone Me With This Question On C++(urgent) I Need To Connect With Any Igcse Computer Science (0478) TeacherHow Magento 2 PWA Mobile App Help To Increase Sales