我想通過zurb爲二十二個插件的滑塊設置動畫。 (http://zurb.com/playground/twentytwenty)Github上:https://github.com/zurb/twentytwenty如何動畫循環jQuery動畫中的CSS「剪輯」屬性?
這是我目前:
$(".twentytwenty-container").twentytwenty({
default_offset_pct: 0.15, // How far to the left the slider should be
move_slider_on_hover: true // Move slider on mouse hover?
});
var leftOffset = parseInt($(".twentytwenty-handle").css("left"), 10);
function animation() {
var options = {
duration: 650,
easing: 'swing'
};
$('.twentytwenty-container')
.find('.twentytwenty-handle')
.animate({
left: leftOffset + 5 + "px"
}, options)
.animate({
left: leftOffset - 5 + "px"
},
$.extend(true, {}, options, {
complete: function() {
animation();
}
})
);
}
function animationIMG() {
var options = {
duration: 650,
easing: 'swing'
};
$('.twentytwenty-container')
.find('.twentytwenty-before')
.animate({
clip: "rect(0px " + leftOffset + 5 + "px 856px 0px)"
}, options)
.animate({
clip: "rect(0px " + leftOffset - 5 + "px 856px 0px)"
},
$.extend(true, {}, options, {
complete: function() {
animationIMG();
}
})
);
}
setTimeout(function() {
animation();
animationIMG();
}, 1500);
$('.twentytwenty-container').mouseenter(function() {
$(".twentytwenty-handle").stop(true).fadeTo(200, 1);
$(".twentytwenty-before").stop(true).fadeTo(200, 1);
});
$('.twentytwenty-container').mouseleave(function() {
leftOffset = parseInt($(".twentytwenty-handle").css("left"), 10);
animation();
animationIMG();
});
無法做出小提琴導致插件不上的jsfiddle工作..我不知道爲什麼?
滑動箭頭的動畫工作,但不是效果(比較)本身不動畫(功能:animateIMG)。 clip-css不會得到動畫效果。
任何幫助表示讚賞,謝謝!