javascript知识点
jsonW
爱编码,爱生活
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
DOM知识点
1.父节点:parentNode无兼容性 2.离当前最近的一个有定位属性的父节点(position:relative):元 素.offsetParent:只读 属性; ①如果没有定位父级,默认是body; ②ie7以下的浏览器,如果当前元素没有定位,默认为body; ③ie7以下的浏览器,如果当前元素有定位,默认为html; ④IE7以下,如果当前元素触发了layout(如:当原创 2015-06-04 18:36:22 · 496 阅读 · 0 评论 -
链式运动框架
function start(obj,json,funct){ var flag=true; clearInterval(obj.timer); obj.timer=setInterval(function(){ for(attr in json){ var current; if(attr=="opacity"){ current=Math.round(parseFloat(get原创 2015-06-12 20:08:25 · 543 阅读 · 0 评论 -
原生js螺旋运动
window.onload=function(){ var oSpiral=document.getElementById('spiral'); var oUl=oSpiral.getElementsByTagName('ul')[0]; var aLi=oUl.getElementsByTagName('li'); var size=6; var len=size*size; var原创 2015-08-14 16:33:03 · 1484 阅读 · 0 评论 -
js简单运动
movement #imgShow{ width: 100px; height: 100px; overflow:hidden; position:relative; } #preview{ position: absolute; width:100px; height: 100px; background-color: red; } Web Design原创 2015-07-24 18:39:00 · 367 阅读 · 0 评论 -
滑动菜单
appleMenu body{margin:0px auto;padding:0px auto;} #menuBar{width:100%;height:70px;position:absolute;bottom:0px;text-align: center;} #menuBar img{width:70px;height:70px原创 2015-08-17 16:21:24 · 763 阅读 · 0 评论 -
圆周运动js
circlar movement #circle{width:30px;height:30px;position: absolute;background-color: lightgreen;left:600px;top:250px;border-radius: 50%;} window.onload=function(){原创 2015-08-18 17:07:51 · 1229 阅读 · 0 评论 -
javascript
/*js不产生冲突,需要避免全局变量的泛滥,合理使用命名空间以及为代码添加必要的注释(可以提高代码的可维护性)*/ window.onload=function(){ var Global={}; Global.nameSpace=function(str){ var arr=str.split('.'); var o=Global; for(var i=(arr[0]='Global原创 2015-08-06 10:53:44 · 399 阅读 · 0 评论 -
有方向的运动js
derective sport #eyes{width:200px;height:300px;position: absolute;left:500px;top:200px;text-align: center;background:url(../images/eye.png) no-repeat;} #leye{border:2px solid b原创 2015-08-19 11:35:43 · 853 阅读 · 0 评论 -
碰撞运动js
window.onload=function(){ var oCrash=document.getElementById('crash'); var speedX=5; var speedY=5; startCrash(); function startCrash(){ setInterval(function(){ var X=oCrash.offsetLeft+speed原创 2015-08-07 14:28:24 · 888 阅读 · 0 评论 -
通过className获取元素的js
//只适用于获取只有一个class名的元素 function getByClassName (oParent, subClass) { var aElements = document.getElemntByTagName('*'); var arr = []; for(var i = 0;i if(aElements[i].classNam原创 2015-10-20 09:36:11 · 846 阅读 · 0 评论 -
jQuery基础
1、对象的实例化: ①使用new关键字 eg://构造函数 function Create(age){ this.age=age; } var firstPerson = new Create(16); ②使用对象字面量(注:在属性列表的最后一个值的末尾,不要使用结尾逗号) eg:var firstObject = { }; var obj1 = obj2 = { };/原创 2015-10-07 13:26:46 · 372 阅读 · 0 评论
分享