我正在使用Scrollorama进行滚动动画,并且我在固定容器下方的元素存在垂直间距问题
http://patrick.tbfdev.com/about-tahiti.php
当您向下滚动时,您会注意到,一旦第一个容器引脚,下面的元素(蓝天图像)下降到页面下方。这不是理想的行为。所需的行为是固定对象下面的元素保持耦合。
这是我的JS:
$(document).ready(function() {
var controller = $.superscrollorama({
triggerAtCenter: false,
playoutAnimations: true
});
// set duration, in pixels scrolled, for pinned element
var pinDur = 900;
// create animation timeline for pinned element
var pinAnimations = new TimelineLite();
pinAnimations
.append([
TweenMax.to($('#slide-a1'), 1.5, {css:{right:'+=2200px', ease:Bounce.easeOut}, delay:0.2}),
TweenMax.to($('#slide-a2'), 1.2, {css:{right:'+=2400px', ease:Bounce.easeOut}, delay:0}),
TweenMax.to($('#slide-a3'), 1.3, {css:{right:'+=3800px', ease:Bounce.easeOut}, delay:.2}),
TweenMax.to($('#slide-a4'), 1.5, {css:{right:'+=5400px', ease:Bounce.easeOut}, delay:.4}),
TweenMax.to($('#slide-a5'), 1.6, {css:{right:'+=6250px', ease:Bounce.easeOut}, delay:.6})
]
, -1)
.append([
TweenMax.to($('#info-a1'), 1.2, {css:{right:'+=2200px', ease:Bounce.easeOut}, delay:0.1}),
TweenMax.to($('#info-a2'), 1.1, {css:{right:'+=2400px', ease:Bounce.easeOut}, delay:0.5}),
TweenMax.to($('#info-a3'), 1.0, {css:{right:'+=2800px', ease:Bounce.easeOut}, delay:1.1}),
TweenMax.to($('#info-a4'), 1.3, {css:{right:'+=2400px', ease:Bounce.easeOut}, delay:1.4})
]
, -2.4)
// pin element, use onPin and onUnpin to adjust the height of the element
controller.pin($('#pin1'), pinDur, {
anim:pinAnimations,
onPin: function() {
$('#pin1').css('height','100%');
},
onUnpin: function() {
$('#pin1').css('height','808px');
}
});