Button not working on Mobile Devices but works on PC bootstrap

前端 未结 3 1729
谎友^
谎友^ 2021-01-05 09:46

I created a bootstrap button that has a link inside. Which looks like this:

\"enter

3条回答
  •  甜味超标
    2021-01-05 10:22

    unfortunately neither setting cursor:pointer; nor adding a touchstart event listener

    $(document).ready(function() {
      $('#button_id').on('click touchstart', function() {
        window.location.href = "/url";
      });
    });
    

    as @noa-dev and @GitPauls suggested worked for me. for reference I tested on my phone7 (ios11.4 and safari)

    working solution: I set the z-index of the button to a large positive number and the button now works.

    #button_id{
      z-index: 99;
    }
    

    solution found thanks to Daniel Acree https://foundation.zurb.com/forum/posts/3258-buttons-not-clickable-on-iphone. I don't know if this generalizes to all iphone/mobile devices.

提交回复
热议问题