0
如果您在下面查看,我在偏移量-185處添加了幾個類,當您向下滾動時,會有兩個動畫/淡入。當您向上滾動偏移量時,我希望將酒吧淡出,但我無法實現此目的。我使用jQuery的航點腳本http://imakewebthings.com/jquery-waypoints/讓jQuery在向上滾動時添加一個類時遇到問題
$('#wrapper').waypoint(function(event, direction) {
$('#scroll-action').toggleClass('hidden', direction === "up");
}, {
offset: -185
}).find('#scroll-action').waypoint(function(event, direction) {
$('#scroll-action').removeClass('hidden');
$(this).parent().toggleClass('sticky', direction === "down");
$('#scroll-action').addClass('animated fadeIn');
event.stopPropagation();
}, {
offset: -185
});
給了這個鏡頭,它沒有添加類。有任何想法嗎? <腳本類型= 「文本/ JavaScript的」> $(函數(){ $( '#包裝')。航點(功能(事件,方向){ 如果(方向=== 「向上」){ $('#scroll-action')。fadeOut(); } else { \t $('#scroll-action')。addClass('sticky'); $('#scroll-action')。fadeIn ); } },{offset:-185}); }); – Camitose
你可以發佈你的HTML或它的一個片段嗎? – scottheckel