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

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

问题描述

是否可以在移动设备上将引导程序网站显示为桌面版本?

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

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

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

例如,BBC 可让您使用页面底部的链接在移动网站和桌面网站之间切换,是我想做的.

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.

谢谢,利亚姆

推荐答案

你只需要设置视口

像你说的那样做一个链接,这个链接是页面的重新加载,但带有?desktop_viewport=true,然后你可以设置一个会话,只要设置了该会话,你就可以编写这个

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">

在你的

将此用作按钮

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

并将其插入到 php 文件的顶部(必须在每个页面上加载女巫)

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天全站免登陆