CSS + JavaScript Transition - help - | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

CSS + JavaScript Transition - help -

I got a simple code here - for experiment. I've tried looking up transition CSS and JavaScript, but I never got the result I wanted. So, on this code what I'm trying to do is to make the 'JavaScript learning' content width to 10. And that's all done with CSS + JavaScript for applying Onclick. https://code.sololearn.com/WXBPQb7gjqdH/?ref=app Function YourBrain(){ If (question make no sense) { please let me know}; else { you = understood question}}

26th May 2019, 3:30 PM
Ginfio
Ginfio - avatar
11 Answers
+ 1
Airree. Thank you for that. learned something new - Target, and using # to link (content).✔️👍
26th May 2019, 6:58 PM
Ginfio
Ginfio - avatar
+ 2
Since you have used the ID tag. It is for us to simplify this point of the code. Example: document.getElementById ("content") == content;
26th May 2019, 5:21 PM
Jônatas Araripe
Jônatas Araripe - avatar
+ 2
I changed the code.
26th May 2019, 5:25 PM
Jônatas Araripe
Jônatas Araripe - avatar
+ 2
<div ID="elem"></div> To select the element simply write the name of its identifier, "elem"; Your "content"!
26th May 2019, 5:31 PM
Jônatas Araripe
Jônatas Araripe - avatar
+ 1
Made with pure JS, added comments https://code.sololearn.com/W8ul0BdszL9a/?ref=app
26th May 2019, 4:08 PM
Airree
Airree - avatar
+ 1
Simple. Create a transition in CSS, set its change attribute and duration time. Perform the modification with JS. Customize in your favor. https://code.sololearn.com/Wuf9kiK12jNE/#css
26th May 2019, 4:55 PM
Jônatas Araripe
Jônatas Araripe - avatar
+ 1
Airree , I am trying to keep it simple (if it is possible). I wanted to add CSS transition, then onclick ...getElementById("").style.transition="" Thank you though. Since I'm just a beginner, Im don't really understand JS. I can do ...function ...document.getElementById("").style.____="__". I and that's about it.
26th May 2019, 5:18 PM
Ginfio
Ginfio - avatar
26th May 2019, 5:24 PM
Jônatas Araripe
Jônatas Araripe - avatar
0
what you mean by ... Since you have used the ID tag. It is......code. Example:document.get...==content; ?
26th May 2019, 5:27 PM
Ginfio
Ginfio - avatar
0
Airree that's without JS? It doesn't have to be with JS, but i was wondering how it was working.
26th May 2019, 6:56 PM
Ginfio
Ginfio - avatar