2016-12-25 20 views
1

我想顯示一個div只有當用戶在SPEED MODE中使用uc mini瀏覽器(它在maxfunzone.com中完成的方式)。以下是我的標記。對此主題的任何幫助都非常重要。如何在UC Mini Browser的Speed模式下播放div?

<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>UC Mini</title> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
<script> 
$(document).ready(function(){ 
    if (navigator.userAgent.match(/^Mozilla\/5\.0 .+ Gecko\/$/)) { 
    $(".info-box").show(); 
} 
else { 
    $(".info-box").hide(); 
} 
}); 
</script> 
<style> 
.info-box{display: none} 
</style> 
</head> 
<body> 
<div class="info-box"> 
some text here 
</div> 
</body> 
</html> 
+0

你爲什麼要這麼做? :) – xFighter

+0

因爲頁面deasign在uc迷你速度模式下打破。 ;) –

+0

如果UC迷你速度不打破你的佈局,那麼我會說,UC速度模式有錯誤或沒有適當實施。爲什麼?這是因爲速度模式必須優化頁面中的佈局,緩存,圖像,樣式表,js文件和其他內容以使用戶可以使用該速度模式。這只是一種以標準方式更快加載內容的方式,但是您錯誤地理解了這個想法。 希望這有助於 – xFighter

回答

0

我已更新您的html,請檢查以下html代碼段。我認爲這可能對你有所幫助。

<!doctype html> 
<html> 
<head> 
<meta charset="utf-8"> 
<title>UC Mini</title> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 
<style> 
    /* webpage/global style goes here */ 
     h1{ 
      color:#008000; 
     } 
</style> 
</head> 
<body> 
<noscript> 
    <!-- Note: Style in 'noscript' tag will not reflect on out side elements when speed mode is off or javascript is turned on. 
     Switch modes in UC mini browser to check the difference. 
    --> 
    <style> 
    /* noscript specific style goes here. */ 
     .info-box{font-size:12px;color:#FF0000;font-weight:bold;} 
     h1{ 
      color:#2187E7; 
     } 
    </style> 
    <div class="info-box">Please turn on javascript or turn off speed mode to make site functional.</div> 
</noscript> 
<h1>HTML5 is Amazing!</h1> 
</body> 
</html> 
+1

不工作:( –

相關問題