简体   繁体   English

Velocity.js显示:与左侧结合使用时,“ block”不起作用:“-50px”

[英]Velocity.js display: 'block' doesn't work when combined with left: '-50px'

Any ideas why when I add {left: '-50px'}, to the velocity command that the display: 'block' and opacity: 1 aren't applied. 当我在速度命令中添加{left: '-50px'},并没有应用display: 'block'opacity: 1任何想法。

In the CSS .popover is set to display: none and opacity: 0 在CSS中, .popover设置为display: noneopacity: 0

The whole thing works fine if I remove the display property out of velocity and use .show() from jQuery, but I want to try do it all in velocity. 如果我取消了display属性的速度并使用了jQuery的.show(),那么整个事情就很好了,但是我想尝试全部以速度完成。

('.popover').velocity({left: '-50px'}, {"opacity": 1}, {display: 'block'});

You are using it wrong, the first object passed to velocity needs to contain the properties to be animated, with the second you are passing options: 您使用的是错误的,传递给力度的第一个对象需要包含要设置动画的属性,而传递给第二个的选项是:

$('.popover').velocity({
     left: '-50px',
     opacity: 1,
     display: 'block'
}, {duration: 1000});

According to the documentation : 根据文档

$element.velocity({ 
width: "500px",
property2: value2
}, {
/* Velocity's default options */
duration: 400,
easing: "swing",
queue: "",
begin: undefined,
progress: undefined,
complete: undefined,
display: undefined,
visibility: undefined,
loop: false,
delay: false,
mobileHA: true
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM