javascript - 使用 jQuery 为相对包装器宽度设置动画时元素消失

标签 javascript jquery css animation

当我为包含 absolute 元素的 relative 定位元素的 width 设置动画时,我遇到了一个奇怪的问题。动画运行时,内部元素消失。动画完成后,显示内部元素。

这是演示:

http://jsfiddle.net/R4Cj5/

当我删除父元素 position: relative 时,内部元素会在动画运行时显示,但我无法相对于父元素定位它。

Basically box with the % should be visible al the time

有人知道这里发生了什么吗?

FIXED : I just added overflow: visible !important; to relative positioned element

工作示例:http://jsfiddle.net/R4Cj5/26/

最佳答案

我认为它可能是一个 jQuery 动画。我很想看到一个没有任何黑客攻击的有效解决方案,但现在这里是 something you might find useful ! :-)

我基本上在动画中添加了另一个功能,完成后它将动画 90% 悬停在进度条上

complete: function() {
    $percent.animate({top: "-26px"})
}

在此用例场景中,您还可以从 .progressbar .percent删除/注释 top: -26px样式表。我还添加了 height: 20px;.progressbar .percentage 的样式中,这样您就可以在滑动时看到 % 的变化。

关于javascript - 使用 jQuery 为相对包装器宽度设置动画时元素消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20219259/

相关文章:

javascript - Jquery 移动页面不扩展可折叠

html - css 和 js url 无法通过布局装饰在基本文件 thymeleaf 上工作

javascript - 导航 Controller ,用于更新导航栏值,仅被调用一次

javascript - 字数统计Jquery函数

javascript - jQuery 获取 YouTube 视频标题

JavaScript : open files with the value of select

html - 防止单词在 iOS 电子邮件客户端中中断/换行

javascript - window.open 页面加载

javascript - 创建 javascript 类时使用什么模式?

javascript - 延迟 url 链接显示在左下角