Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
justinw
14,517 PointsResponsive Website - Hover Popup for Tablets
I've created a responsive website for a client and he has requested that certain icons on hover will display a brief description. In my experience if I implement this request, tablets can not hover so you have to click the icon to see the description and click again on the icon to transfer to the actual page. Is there a way to implement a hover on screen sizes larger than tablets, and no hover on tablets?
2 Answers
Janek Rezner
12,973 Pointsyou could add hover state to media query for desktop devices only?
or use modernizr to detect touch device and only then remove hover rule?
justinw
14,517 PointsI totally forgot that I could use a @media query for screens vs. handheld. This will definitely help and I wish I would have asked this a week ago now. Thanks
Janek Rezner
12,973 PointsJanek Rezner
12,973 Pointslike this:
@media screen and (max-width:700px) { /* overwrite hover styles */ }and also:
@media screen { /* overwrite hover styles */ }@media handheld { /* add hover styles */ }it should work I think