Bootstrap 3 - 移动设备上的桌面视图 [英] Bootstrap 3 - desktop view on a mobile device

查看:97
本文介绍了Bootstrap 3 - 移动设备上的桌面视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在移动设备上时,是否可以将启动网站显示为桌面版本?



基本上页面会显示992像素或1200像素的视口,而不是小设备一个。



例如, BBC 可让您在移动和桌面网站使用页面底部的链接,这是我想做的。



谢谢,
Liam

解决方案

你只需要设置视口



并且这个链接是页面的重新加载,但是有一个?desktop_viewport = true ,那么你可以设置一个会话,只要会话设置你写这个

 < meta name =viewportcontent =width = 1024> 

而不是这个(回应版本)

 < meta name =viewportcontent =width = device-width,initial-scale = 1.0> 

< head> p>

EDITED



使用此按钮

 < a href =mywebsite.php?show_desktop_mode = true>我想要桌面模式!< / a> 

并将其插入到您的php文件的顶部(女巫必须加载在每一页) / p>

 <?php 
session_start
if($ _ GET ['show_desktop_mode'] =='true'){
$ _SESSION ['desktopmode'] ='true';
}
?>

完成后,您必须根据Sessionvalue更改视口,方法是在< head>

 <?php 
if($ _ SESSION ['desktopmode'] =='true'){
/ * DESKTOP MODE * /
?>
< meta name =viewportcontent =width = 1024>
<?php
} else {
// DEFAULT
?>
< meta name =viewportcontent =width = device-width,initial-scale = 1.0>
<?php
}
?>


Is it possible to show a bootstrap website as the desktop version, when on a mobile device?

Basically the page would show the 992px or 1200px viewports instead of the small devices one.

For example, the BBC lets you switch between the mobile and desktop site using a link at the bottom of the page, which is what I would like to do.

Thanks, Liam

解决方案

You Just need to set the Viewport

Make a Link like you said, and this link is a reload of the page but with a ?desktop_viewport=true, then you can set a Session and as long as that session is set you write this

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

Instead of this (Responsive version)

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

In your <head>

EDITED

Use this as a button

<a href="mywebsite.php?show_desktop_mode=true">I want desktop mode!</a>

And insert this at the top of your php-file (witch must be loaded on every page)

<?php
session_start();
if($_GET['show_desktop_mode'] == 'true') {
    $_SESSION['desktopmode'] = 'true';
}
?>

After doing that, you have to change the viewport according to the Sessionvalue by doing this in <head>

<?php
if($_SESSION['desktopmode'] == 'true') {
    /* DESKTOP MODE */
    ?>
    <meta name="viewport" content="width=1024">
    <?php
} else {
    // DEFAULT
    ?>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <?php
}
?>

这篇关于Bootstrap 3 - 移动设备上的桌面视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆