2016-12-25 18 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

不工作:( –

相关问题