0
スクロールがトリガーされるたびに、スクロール機能を無効にするフラグを使用しようとしています。私は.scroll()
を他の機能と併用しているので、$(window).unbind("scroll");
です。それでは、毎回機能が機能しなくなるのはなぜですか?スクロールごとにスクロールが発生しないようにします。
JS:
$(window).scroll(function() {
$("iframe").each(function() {
$this = $(this);
_src = $this.attr('src');
_ID = $this.attr('id');
_yPos = $(window).scrollTop();
_thisHT = $this.height();
_thisTop = $this.offset().top;
_thisBottom = _thisTop + _thisHT;
_Play = true;
if (_Play) {
if(_yPos > _thisTop*0.5 && _yPos < _thisBottom) {
$this.attr('src', _src + '&autoplay=1');
_Play=false;
//$(window).unbind("scroll");
} else {
$this.attr('src', _src);
}
}
});
});
'_Play'は常に真である私は
$(window).scroll;
外_play
を移動しなければならなかったし、私は偽/ increamentsの代わりに、真を使用(つまり、おそらくに動作しますが)。 – Huelfe