スクロール時にHTML5アプリ内でさまざまなフェード/メニュー表示をトリガーするスクリプトがあります-スクリプトは、次のようにIScrollのスクロールの高さを介してトリガーされます-
onScrollMove: function() {
var thisScrol = myScroll.getScrollY()
if (thisScrol < -70 ){
bgfadeToggle('on');
notifToggle('on');
}
if (thisScrol > -70){
bgfadeToggle('off');
notifToggle('off');
}
},
参考までに、機能は次のとおりです-
function notifToggle(whichOne){
if (whichOne == "on" && fifth == "yes"){
setTimeout(function() {fifth="no";}, 10)
$('.notificationArea .notif').animate({
opacity: 0
}, 1500);
}
if (whichOne == "off" && fifth == "no"){
setTimeout(function() {fifth="yes";}, 10)
$('.notificationArea .notif').animate({
opacity:1
}, 2500);
}
}
//Move footer ul depending on scroll position
function bgfadeToggle(which){
if (which == "on" && first == "yes"){
setTimeout(function() {first="no";$('#wrapper').addClass('hov'); }, 10)
$('.appearLate').fadeIn('1000');
$('.footer ul ').animate({
bottom: [ "-40", "linear" ],
opacity: "0"
}, 100, "linear");
$( ".appearLate" ).animate({
top: [ "-1", "swing" ],
opacity: "1"
}, 500, "linear");
}
スクリプトはうまく機能します-ただし..上下にすばやくスクロールすると、両方のスクリプトが同時にトリガーされます-これは、物事がフェードアウトして間違ったタイミングで再びインすることを意味します-スクリプトがこのように反応するのを止める方法はありますか-つまり別の機能が実行されている間に機能を無効にしますか?
何か案は?