How to disable link to phone number when on Desktop?

后端 未结 20 1034
清酒与你
清酒与你 2021-02-03 23:47

How can I add a phone number to a website that is clickable but hides the link when I\'m browsing on a website that doesn\'t support touch.

I could use Modernizr to set

20条回答
  •  佛祖请我去吃肉
    2021-02-03 23:52

    You can use css3 media queries to detect a mobile window and hide the link accordingly.

    @media(max-width:640px){
     .your-calling-link{
    display:none;
    }
    }
    

    Alternately, if you want to show the link and just disable click functionality, use jquery function:

    screen.width 
    

    or

    screen.innerWidth
    

    and disable the click functionality on the link using

     $('.your-link').off(click);
    

提交回复
热议问题