Skip to content

Instantly share code, notes, and snippets.

View cheenwe's full-sized avatar
🐢
Ready

dev.chen cheenwe

🐢
Ready
View GitHub Profile
@cheenwe
cheenwe / js
Created April 20, 2017 05:40
js判断超时
(function () {
var startTime = (new Date).getTime(), //进入页面时间
interval = 0, //进入页面到现在间隔了多少秒
clock;
//每500毫秒计算一次,这里你自己修改
clock = setInterval(function () {
interval = Math.ceil(((new Date).getTime() - startTime) / 1000);
if (interval > 2) { //这里是2秒判断
clearInterval(clock);
@cheenwe
cheenwe / gist:7fb5d658845cdff7bae8a9d28d15e902
Last active March 29, 2017 12:21
判断移动端,控制导航的样式
    /**判断移动端,控制导航的样式**/
    if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE|RIM|Windows Phone|Nexus|Nokia/.test(navigator.userAgent))){
        if(window.location.href.indexOf("?mobile")<0){
            try{
                if(/Android|webOS|iPhone|iPod|BlackBerry|RIM|Windows Phone|Nexus|Nokia/i.test(navigator.userAgent)){
                    loadCSS("css/website/style.mobile.css");
                }else if(/iPad/i.test(navigator.userAgent)){
                    loadCSS("css/website/style.mobile.css");
                }else{
@cheenwe
cheenwe / 0_reuse_code.js
Created December 23, 2015 03:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console