| Desktop | Mobile |
|---|---|
![]() |
![]() |
- JavaScript!😀
-
The
getElementByIdmethod is only available on thedocumentobject. If you want to search within a specific DOM node, use methods likequerySelector,querySelectorAll, orgetElementsByClassName. This is because IDs are unique across the entire document by design. -
Creating a toggle effect with a fade transition in CSS:
.fade-toggle { transition: opacity 0.45s; opacity: 1; visibility: visible; overflow: hidden; } .fade-toggle.hide { opacity: 0; visibility: hidden; height: 0; pointer-events: none; padding: 0; }
-
CSS trick for building a triangle (commonly used for tooltips or arrows):
.social-share-panel__down-arrow { display: block; width: 0; height: 0; border-top: 12px solid var(--color-heading); border-left: 12px solid transparent; border-right: 12px solid transparent; }
-
The
window.matchMedia()method allows to respond to CSS media queries in JavaScript. -
In
addEventListener, if you use an arrow function, you must explicitly pass the event parameter (e.g.,eventore) to access event details. If you use a regular function expression,thisrefers to the element that triggered the event.
- Github - @AminForouzan
- Frontend Mentor - @AminForouzan

