While I have successfully implemented the :hover
event on my website, I am facing difficulties when it comes to using this feature on mobile devices.
Is there a way to disable this functionality through CSS or JavaScript? Despite numerous attempts, I have been unable to find a solution.
I attempted using modernizr.com and media queries, but unfortunately, I did not achieve the desired outcome.
Here is my SASS code snippet:
ul {
li {
padding: 20px;
&:hover {
background-color: $red;
color: $black;
}
}
}
Media query used:
@media (max-width: $screen-sm-min) {
ul {
li {
&:hover {
color: inherit;
cursor: pointer;
}
}
}
}
SASS variable for media query:
$screen-sm-min: 768px;