如何在UC Mini Browser的速度模式下显示div?

时间:2016-12-25 14:17:09

标签: javascript jquery html css browser

我只是在用户在SPEED MODE中使用uc mini浏览器时尝试显示div(在maxfunzone.com中完成的方式)。下面是我的标记。关于这个主题的任何帮助都非常值得赞赏。

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

1 个答案:

答案 0 :(得分: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>