Is there an alternative to fadeOut() that doesn't use display:none for the style? I'd like to just use visibility hidden to avoid any sort of shifting in the page layout?

推荐答案

You can use .animate() on the opacity directly:

$(".selector").animate({ opacity: 0 })

This way the element still occupies space like you want, it just has a 0 opacity, so it's effectively the same as it being visibility: hidden when it finishes.

Jquery相关问答推荐

如何使用 JQuery 将详细信息中的项目包装在容器中?

$(document).scrollTop() 总是返回 0

如何在 jQuery 中获取浏览器滚动位置?

JQuery/Javascript:判断 var 是否存在

如何在循环内创建动态变量名称?

jquery - 单击事件不适用于动态创建的按钮

Rails,单击link_to helper后未加载javascript

使用 jQuery 刷新(重新加载)页面一次?

动画元素变换旋转

$.each(selector) 和 $(selector).each() 有什么区别

如何从表格单元格 (td) 中获取相应的表格标题 (th)?

jQuery UI 工具提示不支持 html 内容

在不丢失光标位置的情况下更新输入值

JQuery Ajax Post 导致 500 内部服务器错误

停止输入/书写后如何触发输入文本中的事件?

使用 jQuery DataTables 时禁用第一列的自动排序

jQuery - 确定输入元素是文本框还是 Select 列表

jQuery ajax 成功回调函数定义

获取jQuery中下拉列表的值

在jQuery中,当它们都具有相同的名称时,如何获取单选按钮的值?