当鼠标悬停在图像上时,跨度内容在两秒钟后向下滑动,当我将光标移出图像时,两秒钟后跨度向上滑动,这很好。
如果有人也将鼠标移到该跨度上,我想显示该跨度,我的问题就开始了......
我不知道我是否足够清楚,但我认为代码会告诉你的不仅仅是文字:)
链接:http: //jsfiddle.net/zDd5T/3/
HTML:
<img id="image" src="button_green.png" />
<span id="content">
<a href="http://www.google.com">Link</a>
Some content here
</span>
CSS:
#image{
left:0px;
position:absolute;
z-index: 10;
}
#content{
top:48px;
left:0px;
position:absolute;
height: 100px;
border: 1px solid #f00;
display: block;
z-index: 0;
width: 100px;
}
JavaScript:
$(document).ready(function() {
$('#content').hide();
var over_img = false;
var over_span = false;
$('#image').live('mouseover', function() {
over_img = true;
setTimeout(function() {
$('#content').show('slide', {
direction: 'up'
}, 1000);
}, 2000);
});
$('#content').live('mouseover', function() {
over_span = true;
setTimeout(function() {
$('#content').show('slide', {
direction: 'up'
}, 1000);
}, 2000);
});
$('#image').live('mouseout', function() {
over_img = false;
if (!over_img && !over_span) {
setTimeout(function() {
$('#content').hide("slide", {
direction: "up"
}, 1000);
}, 2000);
}
});
$('#content').live('mouseout', function() {
over_span = false;
if (!over_img && !over_span) {
setTimeout(function() {
$('#content').hide("slide", {
direction: "up"
}, 1000);
}, 2000);
}
});
});
提前致谢!