Hi Bruno. Can you please explain what the purpose of this line of code is? target.offsetHeight; When i remove this from my code, the animation does not work. But this line keeps throwing a linting warning.
Does not work when you want slide multiple elements at once via querySelectionAll or for example var list = document.getElementsByClassName("class1", "class2", "class3");
slideUp(list, 500); // error target.style relate to multiple elements...
Might be because you are running in strict mode? Try changing to void target.offsetHeight; see if that helps. Ref.: css-tricks.com/restart-css-animation/
with and without box-sizing:
Hi Bruno. Can you please explain what the purpose of this line of code is?
target.offsetHeight;When i remove this from my code, the animation does not work. But this line keeps throwing a linting warning.
This line forces the browser to restart a CSS animation.
Explanation here: css-tricks.com/restart-css-animation/
Further discussion here: sitepoint.com/community/t/why-does...
Does not work when you want slide multiple elements at once via querySelectionAll or for example
var list = document.getElementsByClassName("class1", "class2", "class3");
slideUp(list, 500); // error target.style relate to multiple elements...
This throws an error for me: error Expected an assignment or function call and instead saw an expression.
Its related to the lines:
target.offsetHeight;
target.offsetHeight;
Might be because you are running in strict mode?
Try changing to
void target.offsetHeight;see if that helps.Ref.: css-tricks.com/restart-css-animation/
adding void just creates another linting issue asking to:
Remove this use of the "void" operator. (javascript:S3735)
Ah just relized its a bad copy from: w3bits.com/javascript-slidetoggle/
I like it. But I prefer to add it as prototype, so I call the function "natively"
Thank Bruno :D
Hi, when I use these methods I also need to use the "stop" method from Jquery.
Because we need to stop our animation. Could you help me with it?
Hello,
Sure, i have to do some research but probably you can use: