Is there a workaround for the Android browser bug with CSS-Position and clickable areas?

前端 未结 3 659
傲寒
傲寒 2021-02-13 05:02

When you have some clickable content like , or and before this you have an absolutely positioned eleme

相关标签:
3条回答
  • 2021-02-13 05:50

    Actually I've managed to avoid it by moving the objects below to let them be not visible. But in cases similar to yours the only workaround that actually works is to manage all the clicks in jquery (especially the ones on the background) and to bind/unbind the clicks events on needs. there are also some things that could help on some version/mobiles (but do not solve the problem)

    • the above item has background:rgba(0,0,0,0.1);
    • you should put a gif or png as background of the above element (as well as the background color as point 1)
    • using thouchstart instead of click as bind event sometimes helps.

    the actual version of android/browser are not affected with this bug (or at least it never happen to me) but it could be nice to know the affected versions. If someone has a list.

    0 讨论(0)
  • 2021-02-13 05:50

    I am wondering about a few things here. First, what is the purpose of having an overlaid image and using the image maps? I see you're including jQuery - can you use the hover event with jQuery to change the orientation of the images and do the swap? What about attaching to the click event for the image map, and checking to see if the lightbox is open. If it is, then return false;.

    Just trying to think out loud. Sometimes another take on it can be helpful.

    0 讨论(0)
  • 2021-02-13 06:04

    This is a quick blindfolded reply, so let me know if I should expand/fix it further. The general idea being a CSS class for both the hover and focus events that disables pointer interaction.

    yourElementClass:focus, yourElementClass:hover {
        pointer-events: none;
    }
    
    0 讨论(0)
提交回复
热议问题