摘要:
一.原生js实现吸顶效果 scrollTop属性:元素的最顶部到窗口顶边的距离。即是滚动条滚动的距离 offsetTop属性:元素到其父层顶部的距离。不能对其进行赋值。设置元素到页面顶部的距离请用style.top属性。 var navBar = document.getElementById("# 阅读全文
摘要:
除了strong、em、p标签,其他标签全部清除: str = str.replace(/<(?!\/?strong|\/?em|\/?p)[^<>]*>/ig,'') 阅读全文
摘要:
//只能输入数字且保留2位小数(可正可负) function changeNum(obj) { if(isNaN(obj.value) && !/^-$/.test(obj.value)){ obj.value=""; } if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(ob 阅读全文
摘要:
一,首先要安装node.js node下载地址:https://nodejs.org/zh-cn/download/ 根据自己的的电脑系统选择版本下安装。 查看是否安装成功:npm -v 淘宝镜像:npm install -g cnpm --registry=https://registry.npm 阅读全文
摘要:
<input type="text" autocomplete="off" /> 阅读全文
摘要:
var arr = ["北京","上海","天津","重庆","河北","河南","安徽","湖北","湖南"]; $.each(arr, function(i, val) { console.log(i+"-- --"+val); }); var obj= {name:"小明",male:"男"} 阅读全文
摘要:
1,单行文字显示省略号 div{ width:200px; overflow:hideen; white-space:nowrap; text-overflow:ellipsis; } 2,多行文字显示省略号 div{ width:200px; overflow:hideen; text-overf 阅读全文