我试图让一个跨度出现在mouseOver
或悬停在JQuery中。我想要发生的是,当我将鼠标悬停在box1
上时,应该会出现"sale"
。它不工作,有人可以帮忙吗?如何通过JQuery实现淡入淡出?
HTML:
<div id="columnOne">
<span id="sale">for sale</span>
<div id="box1"></div>
<div id="box2"></div>
</div>
CSS:
#sale{width: 85px;
margin: 0 0 -45px 15px;
padding: 5px;
position: relative;
display: none;
font-size: 14pt;
font-family: 'oxygen', serif;
background-color: #000;
color: #fff;
text-transform: uppercase;
-webkit-border-radius: 5px 5px;
-moz-border-radius: 5px 5px;
border-radius: 5px 5px;}
#box1{width: 240px;
height: 220px;
margin: 10px;
position: relative;
display: block;
background-color: #4174a8;
background-image: url(../images/crown.png);
background-repeat: no-repeat;
background-position: center;
z-index: -1;}
JQuery的:
$(document).ready(function(){
$('#boxt1').hover(function(){
$('#sale').mouseOver('fast');
});
});
你尝试过使用'fadeIn',你不是在任何地方调用它? 'mouseOver'是设置一个事件处理程序,它不接受''fast''的参数。 – Matthew
我做了,只是更新了JSFiddle。仍然不起作用。 – justLearning