我用猫头鹰输送带2 我想改造猫头鹰舞台上,以权当鼠标悬停。 它在CSS中工作。变换不工作与jQuery
.owl-stage:hover {
-webkit-transform: translate3d(-1280px, 0, 0) !important;
transform: translate3d(-1280px, 0, 0) !important;
transition: 450ms transform, 450ms -webkit-transform;
}
由于translate3d值(-1280px)被动态更改为猫头鹰传送带。 我需要检查与jQuery。
$('.owl-stage').hover(function() {
console.log('stage overed');
normalanimation = $(this).css('transform').split(',')[4];
var animation = parseInt(normalanimation) + (-112);
console.log(animation);
//$(this).transition({ x: '-40px' });
$(this).css({ "transform": "translate3d(" +animation+ "px, 0, 0) !important;", "transition": "transform 450ms"});
});
我用了很多其他的方式,如风格atrr。但没有运气。 或者jQuery不支持css转换?
你能尝试使用拨动类,而不是内嵌样式? http://api.jquery.com/toggleclass/ –
什么'动画'在控制台打印出来?你在DOM属性中看到了什么? – Justinas
@SyedFarhan我不能使用切换类,因为当我点击导航按钮或拖动项目时,translate3d值是由owl传送带动态设置的。 – taymyinl