`
keimon
  • 浏览: 72557 次
  • 性别: Icon_minigender_2
  • 来自: 上海
社区版块
存档分类
最新评论

常用示例

 
阅读更多

1)js

//判断滚动停止demo  

var aa = $(window).scrollTop();
    var tt;
    var bb = 0;
    $(window).bind('scroll', function(){
        bb = $(window).scrollTop();
        if(tt == null){
            tt = setInterval(function(){
                aa = $(window).scrollTop();
                if(aa == bb){
                    console.log('滚动停止');
                    clearInterval(tt);
                    tt = null;
                }
            },1000)
        }
    })

 

2)css

/*chrome禁止选中*/
        #mydiv{
            user-select : none ;
            touch-callout : none ;
            user-drag : none ;
            tap-highlight-color : rgba(0,0,0,0) ;

            -webkit-user-select : none ;
            -webkit-touch-callout : none ;
            -webkit-user-drag : none ;
            -webkit-tap-highlight-color : rgba(0,0,0,0) ;
        }

3:javascript:void(0);

1:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FOperators%2Fvoid

2:http://www.zhangxinxu.com/wordpress/2013/01/why-use-href-javascript-void0/

When a browser follows a javascript: URI, it evaluates the code in the URI and then replaces the contents of the page with the returned value, unless the returned value is undefined. The void operator can be used to return undefined.

<a href="javascript:void(0);">Click here to do nothing</a>
<a href="javascript:void(document.body.style.backgroundColor='green');">Click here for green background</a>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics