rnkwill
KPCKevin Powell - Community
•Created by rnkwill on 10/14/2023 in #front-end
How to check if an element contains a class using JavaScript?
Hi all! Another question in regards to my stat module from before. I am trying to use JavaScript to check if the container contains the class "dark-bg" and then do something else. I have tried .matches() and classList.has() it keeps giving me an error. Any help would be grealy appreciated!
https://codepen.io/rnkwill/pen/OJrzroj
33 replies
KPCKevin Powell - Community
•Created by rnkwill on 9/21/2023 in #front-end
Intersection Observer API: How to have each circular progress bar fill when they are in viewport?
Sorry if the formatting is horrible. My first time asking a question! I am creating a stat module for the user to input a value and that value will get taken into a circular progress bar that fills up when the progress bar is in the viewport. I have it working partially BUT I am now stuck. When I have 3 x 2 lay out. All the stats will fill up twice. Once when the first row is in the viewport and another time when second row is in the viewport. Another issue I am running into is when the stats are stacked on mobile - once the first stat is in the viewport it fires for all the stats to fill up at the same time. I would like for the stat bar to fill up as each stat comes into view for mobile and once each time on desktop/tablet. What am I missing here? I can share code as well. Thank you!
54 replies