jquery - How do I activate a hover on link with a touch in touch enabled devices? -
with html this:
<a href="http://google.com" class="readmore">read more</a>
then css this:
a {color:white;} a:hover {background-color:#000;}
how can allow hover , link work on 1 tap on touch enabled device? also, there way activate hover on first tap , trigger link on second tap ?
i think have prevent click on link , trigger redirection on doubleclick only.
change style of <a>
focus
property
$("a").click(function(e){ e.preventdefault(); return false; }) $("a").dblclick(function(){ var location = $(this).attr("href"); console.log("redirection :",location); window.location.href=location; })
a:focus{ color:red; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href="http://google.com">my link</a>
nb : redirection blocked in example working
wiki
Comments
Post a Comment