Javascript 如何在移动设备上强制使用桌面视图 - Bootstrap?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31334481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:32:35  来源:igfitidea点击:

How to force desktop view on mobile devices - Bootstrap?

javascriptjquerymobiletwitter-bootstrap-3responsive-design

提问by Sandeep

How to force desktop view on mobile devices - Bootstrap?

如何在移动设备上强制使用桌面视图 - Bootstrap?

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

我尝试将固定端口设置为 1024 的视口,但它仍然对我不起作用。

Any Advice!!

任何建议!!

采纳答案by Sandeep

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');
}

回答by Simpal Kumar

You just need to set the Viewport

你只需要设置 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 - bootstrap-3-desktop-view-on-a-mobile-device

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

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