0

i have following code

<div>
    <img src="http://placehold.it/350x150"/>
    <div class="link-cont"><a href="#">click here to see more info</a></div>

</div>


div {
    width: 350px;
    font-size:12px;
    position: relative;    
}
div img{
    padding:0 10px;    
}
.link-cont {
    background: red;
    position: absolute;
    bottom: 0;
    width: 370px;
    height: 210px; 
    opacity: 0;
    transition: all 0.4s;
    z-index: -1
}
div:hover  .link-cont {
    opacity: 1; 
    bottom:-40px;
}
.link-cont a{    
    opacity: 0;  
}
div:hover  .link-cont a{
    position: relative; 
    opacity: 1; 
    bottom:-175px;
    left:10px;
    background:#fff;
    color:red;
    text-decoration:none;
    padding:0 10px;
}

A link is wrapped inside a div which appears on hover. how do i make this touch device friendly.

jsfidd--> http://jsfiddle.net/yeyene/Nnd7w/17/

4

2 回答 2

5

Several solutions:

  • skip hover effects in touch device stylesheets
  • use JavaScript to turn hover into click interactions
  • use JavaScript to simulate hover interactions on the touch device (see this Question on StackOverflow
于 2013-06-23T11:10:40.300 回答
-2

Try this:

<script>
document.addEventListener("touchstart", function(){}, true);
</script>
于 2013-06-23T11:42:01.247 回答