简体   繁体   English

使用Zurb Foundation 4时如何在移动设备上切换到桌面视图?

[英]How to switch to desktop view on mobile when you are using Zurb Foundation 4?

I am developed a website using responsive framework Zurb Foundation 4 a little ago. 不久前,我使用响应式框架Zurb Foundation 4开发了一个网站。

Now my client requested to put a button which says "Switch to Desktop Version" and when it is clicked by visitor the site should behave like non-responsive or desktop version should do on a mobile. 现在,我的客户要求放置一个按钮,上面写着“切换到桌面版本”,当访客单击该按钮时,该站点的行为应与无响应或桌面版本在移动设备上的行为相同。

I tried to find something similar in foundation 4 but did not succeed some solutions are just to remove media queries using javascript. 我试图在Foundation 4中找到类似的内容,但没有成功,有些解决方案只是使用javascript删除媒体查询。 Please remember Foundation 4 uses Mobile First... Can anyone please suggest some thing? 请记住,Foundation 4使用的是Mobile First ...任何人都可以提出一些建议吗?

As a starting point you can manipulate the viewport meta-tag with js. 首先,您可以使用js操作viewport元标记。

Originally it is 本来是

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

Add an id for easier reference and change the contents of the attribute content to something like width=1280 : 添加一个id以便于参考,并将属性content的内容更改为width=1280

document.getElementById("myViewportTag").setAttribute('content', 'width=1280, inital-scale=1.0')

Note: This only works on the current page and gets lost with the next page-load. 注意:这仅在当前页面上有效,并且在下一次页面加载时丢失。 But you could use cookies to preserve the preferences of a user and set the viewport on every page-load when the cookie is present. 但是,您可以使用cookie来保留用户的首选项,并在存在cookie时在每个页面加载时设置视口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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