我正在使用视差光滑的旋转木马。我试图找出如何在拖动过程中激活视差。我认为当你点击箭头时它会在幻灯片中激活。
http://jsfiddle.net/ayve1nmf/27/
// On before slide change
$('.data').on('beforeChange', function (event, slick, currentSlide, nextSlide) {
console.log("beforeChange");
//console.log(nextSlide);
parallaxAnimate(this, currentSlide, nextSlide);
});
答案 0 :(得分:2)
您需要应用自己的dragstart或拖动事件。这很简单,它的基础就是这样的
// Event to initiate drag, include touchstart events
$('.data').on('mousedown', function(e){
// Drag start logic
// ...
// Event to end drag, may want to include touchend events
$(this).one('mouseup', function(e){
$(this).off('mousemove');
// Drag stop logic
// ...
}).on('mousemove', function(e){
// Logic for dragging, can get mouse position
// will probably want to throttle
// possibly include touchmove events also
console.log(e.pageX);
});
});