- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法解释为什么我的 slideUp 和 slideDown 不起作用。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>
<div class="text-center">
<button class="btn btn-lg btn-success" type="button" id="show">Show</button>
<button class="btn btn-lg btn-danger" type="button" id="hide">Hide</button>
</div>
<br><br><br>
<table class="table table-striped table-dark">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
<!-- EX1 -->
<!-- $('#hide').on('click', function() { -->
<!-- $('table').hide(); -->
<!-- }); -->
<!-- $('#show').on('click', function() { -->
<!-- $('table').show(); -->
<!-- }); -->
<!-- EX2 -->
<!-- $('#hide').on('click',function() { -->
<!-- $('table').fadeOut(2000); -->
<!-- }); -->
<!-- $('#show').on('click',function() { -->
<!-- $('table').fadeIn(2000); -->
<!-- }); -->
<script type="text/javascript">
$('#hide').on('click', function() {
$('.table').slideUp("slow", function(){
console.log('%c -------->> hide clicked <<--------', "color: green;");
});
});
$('#show').on('click', function() {
$('.table').slideDown("slow", function(){
console.log('%c -------->> show clicked <<--------', "color: green;");
});
});
</script>
</body>
</html>
这里也可以重现
https://jsfiddle.net/bheng/gef1ntLq/
我几乎尝试了所有版本的 jQuery。
最佳答案
表格可能很挑剔,您不应该直接在表格上使用任何动画效果。但如果您将表格打包到一个 div 中并在该 div 上使用 slideUp()
和 slideDown()
,它工作正常。
这是您的 jsFiddle 的更新版本.
关于javascript - jQuery slideDown 和 slideUp 不是动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58002223/
我希望用户能够单击该 div,向下滑动另一个子 div。当用户单击该子 div 内的按钮时,子 div 将向上滑动。 使用下面的 JQuery,div 可以很好地向下滑动。但是,当我单击按钮时,它会向
我有这行 JavaScript,我看到的行为是 selectedLi 立即消失而没有“向上滑动”。这不是我预期的行为。 我应该怎么做才能让 selectedLi 在被移除之前向上滑动? selecte
$(".item").hover( function () { $(this).slideDown().append( $("Yes/No") );
这个问题已经有答案了: Callback of .animate() gets called twice jquery (2 个回答) 已关闭 9 年前。 我正在使用 jQuery 创建一个多选项卡
我正在使用包含 ul 和 li 标签的 side-nav。 看起来像: Mobile PLATFORM SPECIFIC GUIDES Magento Extensi
是否可以使用.slideUp,但对象只能向上滑动(例如)20px,而不是消失在屏幕之外? HTML: Hide Tab 1 Tab 2 JQUERY: $(".
我正在使用 jQuery/Ajax 脚本来提交表单而无需重新加载页面。我的页面上有多个表单,它们都具有相同的类(并且没有 ID)。使用以下方式提交表单效果很好: $('document').r
我在从事这个项目时似乎正在自学 jquery。 我以为会有一种非常简单的方法来实现这种技术,但我到处搜索都没有成功。这是我们正在查看的页面: http://igs.link-networkonline
单击 div 对象时,slideUp 不起作用。 Jquery 代码: $('#show-about-btn').click(function() { $('#show-about-btn')
当 div 悬停在右侧时,我有一个列表会在右侧弹出。我想使用 jqueries SlideUp/Down 来显示和隐藏列表,这在大多数情况下都有效。但有时该功能会重复触发。不断地打开和关闭。我不知道为
$(document).ready(function() { $('#arrow').click(function () { if ($('#slide1').is(":hid
我将创建一个每周日历。当我切换星期时,我想将旧的星期向左或向右滑动以获取新内容。有谁能够帮助我?目前我没有好主意来实现这个。 非常感谢。 最佳答案 例如向左滑动而不是 .slideUp()您可以使用.
我想做的就是: 有7个数字和7个div,它们相互关联(nr 0与div 0有关系) 当点击其中一个数字时,它应该折叠所有其他未被选中的 div 可以一次多选 综上所述,基本上,页面有一些带有数字的标签
在表格行中显示或隐藏一些 div 后,如何为高度调整设置动画?基本上,在用户在单选组中进行选择并将鼠标悬停在该行之外后,其他单选选项将被隐藏以压缩表单。如果他们将鼠标移回该行,所有单选选项将再次出现。
当我滚动页面时,我想为页眉设置动画。它应该slideUp,添加一个类和slideDown。 slideUp 和 slideDown 按预期工作,但未添加类 header-small。怎么会? $(fu
我有一个我创建的 Accordion 样本;问题很简单:第一次单击任何 Accordion 项目时,slideUp() 动画不起作用。我在链接 jquery 方法方面仍然不太熟练,所以我的问题是:我应
如何确保多个 div 向上滑动?现在我有这个功能: $("div#personal").click(function() { $("div.1").slideUp("slow", function
我创建了一个带有旋转木马导航的 Flexslider。导航被设计为移动屏幕尺寸的垂直列表。 在移动设备上:我想隐藏列表(点击的幻灯片标题除外),以便用户可以看到所选的幻灯片。 在大屏幕上:我只想让简单
我在使用 jQuery slideUp() 方法时遇到问题。我有一个计时器设置为在 1 秒内向上滑动一个 div,然后显示一个段落。我的 div 中有一个位于屏幕中央的 h1 元素。问题是当这个 h1
我有一个图标可以同时触发向上滑动和向下滑动的效果,但是在向下滑动之后,如果我再次按下同一个图标,它就不再起作用了。 $(document).ready(function(){ $('.subc
我是一名优秀的程序员,十分优秀!