最新回答 / rainy_li3676598
在CSS里面,有对 lihover进行定义,然后通过 触发onmouseover的事件,调用函数,函数里面有一句: this.className = 'lihover'; 就是将对象的类 定义为 .lihover这个类,.topmenu .lihover /*鼠标移动到上面时,应用的样式*/ { border: 1px solid #DDD; border-right: 0; box-shadow: 0 0 8px #DDD; -moz-box-shadow: 0 0 8...
2016-01-29
var h = this.getElementsByTagName("div")[0].offsetTop + y;
这样对吗?
这样对吗?
2016-01-27
font-size: 11pt;
list-style-type: none;
text-align: left;
padding-left: 8px;
z-index: 3;
background-image: url(1.png);
background-repeat: no-repeat;
background-position: right;
}
list-style-type: none;
text-align: left;
padding-left: 8px;
z-index: 3;
background-image: url(1.png);
background-repeat: no-repeat;
background-position: right;
}
2016-01-25
window.onload = function () {
var ali = document.getElementsByTagName('li');
for(var i=0;i<ali.length;i++)
{ali[i].i=i;
ali[i].onmouseover = function(){
this.className = "lihover";
}
ali[i].onmouseout = function(){
this.className = "";
}
}
var ali = document.getElementsByTagName('li');
for(var i=0;i<ali.length;i++)
{ali[i].i=i;
ali[i].onmouseover = function(){
this.className = "lihover";
}
ali[i].onmouseout = function(){
this.className = "";
}
}
最新回答 / carolcoral
你应该说的是style.top和offset.top吧style.top指的是你在css中定义了的top值,而offset.top是指div内部的top值判断的意思是判断二级的div的底部位置和一级菜单对应的栏的高度差来判断是否错位了,如果他们的差值是正数说明二级在一级上已经错位,所以需要加上一个top*h的像素高才能看的是一一对应的
2016-01-21
最新回答 / 孩纸╭别伤xin、了
.style.top是带单位“px”的,而offsetTop是不带单位的。比如:.box{position:absolute; top:20px;}其中,.style.top="20px",而offsetTop=20;
2016-01-18
.topmenu li{
background-image:url('http://img1.sycdn.imooc.com//5411027300014f0200220030.jpg');
background-repeat:no-repeat;
background-position:right;
background-color:rgba(0,0,0,0.03);
}
.topmenu li:hover{
background-color:rgba(0,0,0,0.0);
background-image:none;
}
background-image:url('http://img1.sycdn.imooc.com//5411027300014f0200220030.jpg');
background-repeat:no-repeat;
background-position:right;
background-color:rgba(0,0,0,0.03);
}
.topmenu li:hover{
background-color:rgba(0,0,0,0.0);
background-image:none;
}