这次给大家带来DIV绑定鼠标事件,滑动时由下向上展开,DIV绑定鼠标事件,滑动时由下向上展开的注意事项有哪些,下面就是实战案例,一起来看一下。
鼠标浮动时p由下向上缓慢展开效果
html>
<meta><title>jQuery响应鼠标实现p由下向上展开</title><style>
.big{position:relative; width:234px; height:300px; background:#ccc}
.show{position:absolute; display:none; bottom:0px;display:block; width:100%; height:auto; background:#f66 }
</style><script></script><script>
$(document).ready(function()
{
$(".big").hover(function () {
$(".show").stop(true,true).animate({height:"70px"});
}, function () {
$(".show").stop(true,true).animate({height:"0px"});
});
});
</script>
<!--灰色的p-->
<p>
<!--红色的p-->
</p><p></p>
原理:
① 首先红色p是通过position:absolute绝对定位的,且通过相对与底部定位,如bottom:0px。
② 底部定位固定,高度变高的时候就向上扩展了。
③ 使用jQuery的$().animate()动画方法,控制红色p高度变化。
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:











