0

CSS/js animation

So, I have a slider and when slider.value>X I need to smoothly increase width of div object from 200px to 500px. Then when slider.value<X make the same backwards. How can I make such animation?

25th Mar 2019, 8:38 PM
Tarasov Maks
Tarasov Maks - avatar
4 Answers
+ 1
Two ways of doing this are: 1. Using CSS, give the div a 'transition: 1s' property. Then alter the width using javascript: document.getElementById("mydiv").style.width = "500px"; 2. Use jQuery to animate the change. It would be something like: $("div).animate({width:"500px"},1000); See the jQuery course for more info.
25th Mar 2019, 9:05 PM
Jassi Rooste
Jassi Rooste - avatar
0
Thank you, friend!
25th Mar 2019, 9:43 PM
Tarasov Maks
Tarasov Maks - avatar
0
Maybe you also know some way to change CSS “animation-timing-function” property?
25th Mar 2019, 9:48 PM
Tarasov Maks
Tarasov Maks - avatar
0
in the same way
25th Mar 2019, 9:51 PM
Tarasov Maks
Tarasov Maks - avatar