我用貓頭鷹輸送帶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