Submitted over 4 years agoA solution to the Agency landing page challenge
Landing Page using Vue3 + Vite with Mobile-first workflow
LVL 3
@joanneccwang

Solution retrospective
In this project, the biggest takeaway for me is learning how to work with JS media queries using window.matchMedia() method. Reference from CSS Tricks
// Create a media condition that targets viewports at least 768px wide
const mediaQuery = window.matchMedia('(min-width: 768px)')
const handleMediaQueryChanged = (e) => {
// Check if the media query is true
if (e.matches) {
// Then log the following message to the console
console.log('Media Query Changed!')
}
}
// Register event listener
mediaQuery.addListener(handleMediaQueryChanged)
// Initial check
handleMediaQueryChanged(mediaQuery)
-- Any feedback is welcomed. Thanks in advance!
Code
Loading...
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Joanne Wang’s solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord