javascript - 不使用 jquery animate() 动画元素

标签 javascript jquery css animation

我需要使用动画将元素从一个偏移位置移动到另一个偏移位置。 我正在使用

function getOffset(el) {
    el = el[0].getBoundingClientRect();
    return {
        left: el.left + window.scrollX,
        top: el.top + window.scrollY
    }
}
var _anchorElemPos = getOffset($element)
_animationElement.animate(_targetAnimPos); /*_targetAnimPos is the position where the element has to move.*/

它工作得非常好。但现在我想要没有 jquery animate() 函数的动画。

如有任何帮助,我们将不胜感激。

最佳答案

试试 CSS3 动画。对于移动,您可以使用 CSS3 中的关键帧

关于javascript - 不使用 jquery animate() 动画元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41561332/

相关文章:

javascript - 文本轮播在 Jquery 中不起作用

javascript - 使用 jQuery 将复选框值添加到隐藏字段

jQuery datepicker 返回显示/显示的天数

Css 元素最大尺寸

css - 如何向 Shopify 网站添加移动优化的外部 CSS

javascript - 在 InfoBubble.js 中使用 fancyBox 和 Google Maps API

javascript - Magento 创建自定义职业表单并从 CMS 页面调用

css - 如何通过其部分类名 CSS 获取元素

javascript - 在 ajax 处理期间,当我们在弹出窗口外单击时,不应关闭弹出窗口

javascript - 如何在另一个模式弹出窗口处于事件状态时关闭一个模式弹出窗口