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);
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>