Thanks for the max-height trick i was trying to send my answers upwards with translateY and negative margin top values :D Finally making accordion components with animations. Have a nice day
this tutorial was amazing, wow, I've learned so many new things and also new tricks about what I've used before, amazing! thank you, I'll be coming back for more tutorials!
@Developer Empire Thank you, all of it looks very good! Can you suggest a few excellent resources from where one could learn about SVG and advanced CSS? One of your lines there in CSS (line 65 I believe,) looks advanced to me, so I'd like to learn.
this helped so much, thank you! but can anyone explain why my arrow is only appearing half :( its like a half-v and looks more like a backslash for some reason. i think i followed the code closely but still couldnt determine what went wrong..would love to get some insight on this!
I had the same. Depends on your background. I had a white background, and then the white SVG line obviously disappears and the only part remaining is the black fill of the triangle. You would need to set: stroke="black" (or any color you need) and fill="transparant" (in the path options) to get rid of the small black triangle. The way it was shown here, it will only look good on a black background.
Why do You set max 300? How do You know how much text everyone uses? For me it's bad example of accordion because it's not for future projects where you could have more text.
It would have to look like this: faq.addEventListener("click", () => { if(!faq.classList.contains("active")){ faqs.forEach(faq => { faq.classList.remove('active'); })} faq.classList.toggle("active"); }); So check if the current clicked on FAQ is already active. If not, then remove the active class from all items, otherwise just toggle the active state.
Mine has more space between the title and the paragraph regardless of what margin or padding I try to use. Can someone help? The code is the same. Trust me. I've checked.
The solution is not bad, but if you do not know the final maximum height, then difficulties arise here, if you specify the maximum height in auto, then the animation stops working, I still have not found solutions to this issue, if someone has a solution, please share
I know I'm late, but if you want to do it without set max-height then u should put transform translateY(-100%) instead, and overflow hidden. Then for active class just bring back translate to 0
A code that actually works, thank you. Really straightforward and short.
This is a wonderful video! I'm just learning JavaScript and watching it done line-by-line is EXTREMELY helpful! Thank you!
really straightfoward and readable code. thanks!
const faqs = document.querySelectorAll(".faq");
faqs.forEach(faq => {
const question = faq.querySelector(".question");
const answer = faq.querySelector(".answer");
question.addEventListener("click", () => {
if (faq.classList.contains("active")) {
faq.classList.remove("active");
answer.style.maxHeight = null;
} else {
// закрытие других активных блоков
faqs.forEach(otherFaq => {
if (otherFaq.classList.contains("active")) {
otherFaq.classList.remove("active");
otherFaq.querySelector(".answer").style.maxHeight = null;
}
});
faq.classList.add("active");
answer.style.maxHeight = answer.scrollHeight + "px";
}
});
});
added hiding inactive blocks
Thanks
Thanks for the max-height trick i was trying to send my answers upwards with translateY and negative margin top values :D Finally making accordion components with animations. Have a nice day
Thank you for share this amazing video, you helped-me very much.
Thanks you very much
Fantastic video. I will for sure use some of the tricks that you have used.
THANK YOU THAT WAS REALLLYY COOOLL!!!!!!!!!
A.o.A!
Ur effort is really helpful for us,thanks alot
this tutorial was amazing, wow, I've learned so many new things and also new tricks about what I've used before, amazing! thank you, I'll be coming back for more tutorials!
thank you bro
Really nice tutorial
Great, thank you very much!!
very good thank you
thank you, this was really simple to follow.
Thank you for this tutorial, it's really helpful and amazing.
I learnt so much from it
Thakyou so so muchhhhhhh😍😍😍😍
Nice video !!! Good job bro, thanks !
Thank you bro, great video
Plz source code
Thanks it is really help full
Thank you bro..
thank you so much man😭
Thank you very much!
thanks man👏👏
Awesome job !
Thank you very much! This tutorial was so helpful
thanks bro, u helped me so much
Can uh help me bro?
Really nice tutorial. Very simple to follow. Thanks a lot for this.
thank you so much
Thank you!
thank you bro ,you have earned my respect
Quick question was it responsive to you or not
Thank you! You're help me! ;)
nice
What do you use to autocomplete in css?
Thank you :)
thanks :)
под музычку норм)
good shiz
thank you~~!
@Developer Empire
Thank you, all of it looks very good! Can you suggest a few excellent resources from where one could learn about SVG and advanced CSS? One of your lines there in CSS (line 65 I believe,) looks advanced to me, so I'd like to learn.
thanks
What if height of ech content is different?? Could you make a video when we 2-3 accordions js??
this helped so much, thank you! but can anyone explain why my arrow is only appearing half :( its like a half-v and looks more like a backslash for some reason. i think i followed the code closely but still couldnt determine what went wrong..would love to get some insight on this!
I had the same. Depends on your background. I had a white background, and then the white SVG line obviously disappears and the only part remaining is the black fill of the triangle. You would need to set: stroke="black" (or any color you need) and fill="transparant" (in the path options) to get rid of the small black triangle. The way it was shown here, it will only look good on a black background.
@@Ditzj thank you ❤️
@@Ditzj where exactly is "fill" ?
@@yskthegamer9033 as an example:
Do you have a document where i can copy this code both Html and css
please i need it too
source code pls
But 1thing which can't understand (where is "active,s class ")plz help me
class=active get's set in the javascript when you click on the specific div-element
Thank you
How can we implement in blogger template
i just dont fucking get it.. we have the same structure yet it doesnt work in my project..
me either, did you get it?
@@andressmendess I don't get it either. I copied the exact same thing and it still isn't working
Jerde Hollow
Jerad Forge
Why do You set max 300? How do You know how much text everyone uses? For me it's bad example of accordion because it's not for future projects where you could have more text.
set max to fit-content
What this design name
can u give source cod?
when you click on another one is not closing ,?
you are right, other remains open
It would have to look like this:
faq.addEventListener("click", () => {
if(!faq.classList.contains("active")){
faqs.forEach(faq => {
faq.classList.remove('active');
})}
faq.classList.toggle("active");
});
So check if the current clicked on FAQ is already active. If not, then remove the active class from all items, otherwise just toggle the active state.
@@Ditzj thank you
Alguien puede decirme los códigos para que abra solo 1 respuesta, al darle clic que se oculte la anterior.????
is it responsive??
yes,was
Enid Fork
gj
Mine has more space between the title and the paragraph regardless of what margin or padding I try to use. Can someone help? The code is the same. Trust me. I've checked.
Thank Youuuu
can you please upload the source code?
svg is not showing
The solution is not bad, but if you do not know the final maximum height, then difficulties arise here, if you specify the maximum height in auto, then the animation stops working, I still have not found solutions to this issue, if someone has a solution, please share
You can set the max-height to fit-content ( .faq.active .answer{max-height: fit-content;}
@@hedikharouf297 When you specify this property, the animation stops working.
I know I'm late, but if you want to do it without set max-height then u should put transform translateY(-100%) instead, and overflow hidden. Then for active class just bring back translate to 0
send me code
html css js
send me code please
vulu ... ocay ...
souce code :>>
It doesn't work 👎
not a good tutorial!
source code plz