2017-07-21 7 views
0

以下のコード(or jsfiddle)が機能しません。しかし、私のモバイルアプリケーションではうまくいきます。それが何をすべきかは、矢印(下のボタンへのスクロール)を下にしてフェードアウトさせ、その後に戻ってきたら視界に戻ってフェードバックさせることです。下にスクロールして発射動作を行わない

なぜブラウザ(クロム)で機能しないのですか?あなただけの "=" 記号不足している

$(window).bind("mousewheel DOMMouseScroll scroll swipe touchmove touchstart", function (e) { 
    var hT = $('#bottom').length ? $('#bottom').offset().top : 0, 
      hH = $('#bottom').outerHeight(), 
      wH = $(window).height(), 
      wS = $(this).scrollTop(); 
    if (wS > (hT + hH - wH)) { 
     $('.saveForm').fadeOut(); 
    } else { 
     $('.saveForm').fadeIn(); 
    } 
}); 

答えて

3

;)

$(window).bind("mousewheel DOMMouseScroll scroll swipe touchmove touchstart", function (e) { 
    var hT = $('#bottom').length ? $('#bottom').offset().top : 0, 
      hH = $('#bottom').outerHeight(), 
      wH = $(window).height(), 
      wS = $(this).scrollTop(); 
    if (wS >= (hT + hH - wH)) { // = here when it is at the bottom 
     $('.saveForm').fadeOut(); 
    } else { 
     $('.saveForm').fadeIn(); 
    } 
}); 

注意してください、機能がイベントをスクロールするバインドされています。矢印ボタンをクリックしたときにボタンを非表示にしたい場合は、そのイベント(onclick)もチェックする必要があります。

+1

Doh!ありがとう。目の別のペアはあなたが時々必要とするものです。 –

関連する問題