How to simulate hover effect on touch devices?

后端 未结 2 1618
傲寒
傲寒 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: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').

提交回复
热议问题