javascript - 这个jquerys 小动画怎么达不到效果??

查看:133
本文介绍了javascript - 这个jquerys 小动画怎么达不到效果??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
    $("div").mouseenter(function(){
        $(this).stop(true,false);
        $("p").slideUp(400);
    }).mouseleave(function(){
        $(this).stop(true,false);
        $("p").slideDown(400);
    })
});
</script>
</head>
<body>
<div style="height:250px;border:blue 1px solid">
    <p style="border:red dotted 2px;height:200px">这是一个段落。</p>
</div>
</body>
</html>

为什么鼠标快速出入,动画为什么还会有延迟??那stop(true,false)写错了吗?? 求大神指点

https://jsfiddle.net/cdggm1cm/

解决方案

$("p").stop(true,false);
为啥写成this

这篇关于javascript - 这个jquerys 小动画怎么达不到效果??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆