簡體   English   中英

何時需要無縫啟動網站的移動版本?

[英]Seamless start of mobile version of site when needed?

我的網頁上有JavaScript,可檢測移動瀏覽器並對網站進行CSS調整,使其適合移動使用。

但是該站點首先仍然顯示為“桌面”版本,然后需要一些時間來重新格式化自身。 這會產生令人愉悅的負載體驗。

我贊賞如何使用js或任何其他方式立即顯示移動版本而不是桌面版本的好方法。

您可以重定向到移動頁面

<script type="text/javascript">
<!--
if (screen.width <= 700) {
document.location = "/mobile";
}
//-->
</script>

或用於同一頁面的CSS修復程序使用:

@media screen and (max-width:800px) {

// then put your mobile css in here

}

相同,但特定於iPhone 5

@media screen and (device-aspect-ratio: 40/71)
{

}

此處提供更多信息: http : //css-tricks.com/snippets/css/media-queries-for-standard-devices/iPhone 5 CSS媒體查詢

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM