How to simulate hover effect on touch devices?

后端 未结 2 1608
傲寒
傲寒 2020-12-16 04:52

I have a web page with some css3 animation on hover and I would like to make it work on iPad (and any touch enabled device) when the user touch these elements.
Here\'s m

相关标签:
2条回答
  • 2020-12-16 05:13

    or you can add :hover class under css like a#man:hover{....} [same goes if you want the same effect or use diff. colors or image for the diff. results].

    0 讨论(0)
  • 2020-12-16 05:20

    try this

    $('#arm').bind('touchstart', function() {
            $(this).removeAttr('style').css('bottom','244px');
            $(this).addClass('hover_effect');
    });
    
    $('#arm').bind('touchend', function() {
            $(this).removeClass('hover_effect');
    });
    

    similarly for $('#man').

    0 讨论(0)
提交回复
热议问题