索菲亚呀吧 关注:1贴子:522

回复:工作(来乐)之后学到的

取消只看楼主收藏回复

http://www.wufangbo.com/css-jin-zhi-xuan-ze/ 禁止选中文字
user-select有两个值:
none:用户不能选择文本
text:用户可以选择文本
需要注意的是:user-select并不是一个W3C的CSS标准属性,浏览器支持的不完整,需要对每种浏览器进行调整
body{
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}
IE6-9还没发现相关的CSS属性
//IE6-9
document.body.onselectstart = document.body.ondrag = function(){
return false;
}


IP属地:北京39楼2015-11-26 09:08
回复
    input灰色文字提示
    <input class = "nav_fifth" type="text" style="color:gray" value="来乐一下" onfocus="if(this.value=='来乐一下'){this.value=''};this.style.color='black';" onblur="if(this.value==''||this.value=='来乐一下'){this.value='来乐一下';this.style.color='gray';}">


    IP属地:北京40楼2015-11-26 10:29
    回复
      github 很厉害


      IP属地:北京42楼2015-11-27 11:47
      回复
        CSS3 Filter的十种特效
        http://www.w3cplus.com/css3/ten-effects-with-css3-filter


        IP属地:北京43楼2015-11-27 11:47
        回复
          // 获取窗口宽度
          if (window.innerWidth)
          winWidth = window.innerWidth;
          else if ((document.body) && (document.body.clientWidth))
          winWidth = document.body.clientWidth;
          // 获取窗口高度
          if (window.innerHeight)
          winHeight = window.innerHeight;
          else if ((document.body) && (document.body.clientHeight))
          winHeight = document.body.clientHeight;
          特别常用啊


          IP属地:北京44楼2015-12-01 11:22
          回复