我想通过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不会得到动画效果。
任何帮助表示赞赏,谢谢!