[英]How to force desktop view on mobile devices - Bootstrap?
How do i force desktop view on mobile devices with Bootstrap?如何使用 Bootstrap 在移动设备上强制执行桌面视图?
I have tried fixing the viewport
width to 1024, but still it doesn't work me.我已经尝试将viewport
宽度固定为 1024,但它仍然对我不起作用。
Any Advices?任何建议?
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
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}" name="viewport" content="width= {screenWidth}"
至于我,我使用这个我将初始视口比例设置为0.1
<meta name="viewport" content="width=device-width, initial-scale=0.1">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.