Clickable website image not working on iphone and android devices

后端 未结 1 1128
暗喜
暗喜 2021-01-23 06:08

I use the platform virb.com for my website and am having issues with getting my clickable images to work on iPhone and Android mobile devices. Some links work at times and then

相关标签:
1条回答
  • 2021-01-23 06:33

    Mobile Safari passes touch events through for things that are obviously touchable like links or buttons. However, if you are using Javascript to add touch events to other html elements like an <img> or <div> tag you can let Safari know it's touchable by setting style:

    cursor:pointer;
    

    either on the element or in a css class on the element.

    If you can add a css class to one of your files, you could do something like this in the head section:

    <script>
        .mobil-click-element {
            pointer:cursor;
        }
    </script>
    
     // Then put the class on the element you want to be clickable
     <div class="mobil-click-element">some other html</div>
    

    If you can't edit the css you can put the style directly on the element like so

     <img style="cursor:pointer" ... />
    
    0 讨论(0)
提交回复
热议问题