简体   繁体   中英

How to force desktop view on mobile devices - Bootstrap?

How do i force desktop view on mobile devices with Bootstrap?

I have tried fixing the viewport width to 1024, but still it doesn't work me.

Any Advices?

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

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');
}
  • The best way is to either sent content empty ie

    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.1

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM