您的位置:首页 > 移动开发

判断是否为pc还是手机端以及手机端a标签点击闪亮处理

2017-11-17 10:30 393 查看
通过判断跳转不同终端:
(function(){
var sUserAgent = navigator.userAgent.toLowerCase();
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
var bIsAndroid = sUserAgent.match(/android/i) == "android";
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
if (! (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
window.location.href = 'pc.html';
}else{
window.location.href = 'phone.html';
}
})()
闪亮以及有背景处理,当点击时背景透明化即可。
.class{
-webkit-tap-highlight-color:transparent;//方法一
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);//方法二
tap-highlight-color: rgba(0, 0, 0, 0);//方法三
}
form后提交:
<form action=’url’ method=’post’>
<input type=’text’ name=’username’ />
<input type=’password’ name=’password’/>
<input type=’submit’ value=’登陆'/>
</form>
提交的数据格式为:username=username&password=password.
跳转到url页面。
$('#form').submitForm({
url: "/xxxxx/submit",
dataType: "text",
callback: function (data) {

},
before: function () {
}
}).submit();
此时可以在callback函数中对请求结果进行判断,
然后执行不同的动作(页面跳转或刷选数据、提醒错误都可以)

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: