I was unable to toggle the classList of a previousElementSibling. Please, check out the 'script.js' section for more info. Thanks.
Ignacio Andrés Molina
@StrocsAll comments
- @shinaeliSubmitted almost 2 years ago@StrocsPosted almost 2 years ago
Hi @shinaeli, I was looking on your code and found your problem.
previousElementSibling is working just fine, your problem is with css selectors specificity:
Change class selector + type selector (.compo h3) to a type selector (h3), this is because a class + type selector will have high priority over just a type selector, or class selector. (this is not the best solution, always is better use a class selector for every element)
h3 { padding: 5px; background-color: hsl(25, 47%, 15%); color: #fff; font-size: 12px; border-radius: 2px; margin-bottom: 5px; text-align: center; display: none; }
This is a great article for learn css selector specificity: Importance of CSS Specificity and its best practices
Hope this helps you! have a nice code day 😀
0 - @mmiskiewicz99Submitted about 2 years ago
I have a issue with background image. In Visual Studio everything working well and picture shows properly. After publish on github pages image not showing.
@StrocsPosted about 2 years agoHello Marcin, Great Solution! gratz!
I was looking at your code and this is your problem:
body{ background-image: url(../images/pattern-background-mobile.svg); }
that means your link path is looking one folder up, try this:
body{ background-image: url(./images/pattern-background-mobile.svg); }
./ :- This delimiter points to the parent folder of the current working file. It gives access to all the files and folders in the parent folder of the current working file. Let us look at another project structure.
../ : This delimiter points one folder up the parent directory/folder of the current working file i.e it points to the parent folder of the parent folder of the current working file. More like to the grand parent folder.
Source: Understanding File Paths
Hope will be useful, Cheers!
0