"use strict"; // javascript document //按需写入所需的函数名 $(function () { // 用于测试 var h = 0; checkbrowser(); // 阻止默认行为写法,chrome56以上版本 // document.addeventlistener('touchmove', func, ispassive() ? { // capture: false, // passive: false // } : false); } // 以下不用可以删除 //表单相关 );function forms() { //输入框文字清空还原,控制value // $(".deasearch .inp").focus(function () { if ($(this).val() == this.defaultvalue) { $(this).val(""); } }).blur(function () { if ($(this).val() == '') { $(this).val(this.defaultvalue); } }); } //简单标签切换 function tabs(tit, box) { /*html结构
内容一
内容二
*/ var $div_li = $(tit).children(); var $box_li = $(box).children(); var i; $box_li.hide(); $div_li.each(function () { if ($(this).hasclass('on')) i = $(this).index(); }); $box_li.eq(i).show(); $div_li.click(function () { $(this).addclass("on").siblings().removeclass("on"); var index = $div_li.index(this); $box_li.eq(index).fadein("linear").siblings().hide(); }); } // 判断浏览器 var checkbrowser = function checkbrowser() { var useragent = navigator.useragent.tolowercase(); var msie9 = /msie 9\.0/i.test(useragent); var msie8 = /msie 8\.0/i.test(useragent); var msie7 = /msie 7\.0/i.test(useragent); var msie6 = /msie 6\.0/i.test(useragent); var checkhtml = ''; // if (msie9 || msie8 || msie7 || msie6) { // $('body').append(checkhtml); // }; if (msie8) { checkhtml = '
您现在使用的是ie8内核,版本过低!建议您升级到ie9+或者使用极速模式浏览,以体验最佳效果!×
'; $('body').append(checkhtml); } else if (msie7) { checkhtml = '
您现在使用的是ie7内核,版本过低!建议您升级到ie9+或者使用极速模式浏览,以体验最佳效果!×
'; $('body').append(checkhtml); } else if (msie6) { checkhtml = '
您现在使用的是ie6内核,版本过低!建议您升级到ie9+或者使用极速模式浏览,以体验最佳效果!×
'; $('body').append(checkhtml); } checkbrowser.close = function () { $('.checkbrowser').remove(); }; }; // 判断是否移动设备 var ismobile = function ismobile() { 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) { return true; } else { return false; } }; function func(e) { e.preventdefault(); } $('.scroll-top').click(function(event) { $('html,body').animate({ scrolltop: '0' }, 400); }); $(function() { fix(); $(window).scroll(function(event) { fix(); }); function fix() { var wintop = $(document).scrolltop(); var menumiddle =$(window).height()/2; if(menumiddle < wintop) { $('.fix-right').fadein('500'); } else { $('.fix-right').fadeout('500'); } } });