How to force desktop view on mobile devices - Bootstrap?

后端 未结 3 1879
眼角桃花
眼角桃花 2020-12-05 20:16

How to force desktop view on mobile devices - Bootstrap?

I tried viewport with fixed port to 1024, but still it dont work me.

Any Advice!!

相关标签:
3条回答
  • 2020-12-05 20:50

    You just need to set the Viewport

    <meta name="viewport" content="width=1024">
    

    Instead of this (Responsive version)

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    Look at here. Should solve your issue.

    SO - bootstrap-3-desktop-view-on-a-mobile-device

    SO - how-to-show-desktop-version-on-mobile-screens-in-bootstrap-3

    0 讨论(0)
  • 2020-12-05 20:56

    Thanks All,

    This code works for me:

    var viewMode = getCookie("view-mode");
    if(viewMode == "desktop"){
        viewport.setAttribute('content', 'width=1024');
    }else if (viewMode == "mobile"){
        viewport.setAttribute('content', 'width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no');
    }
    
    0 讨论(0)
  • 2020-12-05 21:00
    • The best way is to either sent content empty i.e.

      name="viewport" content=""

    or

    • Take a variable to have the screen width so that it can work on all the screen sizes

      name="viewport" content="width= {screenWidth}"

    0 讨论(0)
提交回复
热议问题