1
我試圖得到一段代碼只執行一次,當滾動到:上滾動更改代碼永久
$('#main_nav').addClass('past-scrollpoint');
$('#content-block').addClass('past-scrollpoint-content');
$('#header').addClass('hidden');
但是,代碼處於非活動狀態,一旦點小於740
這是我最好的嘗試:
$(window).on('scroll', function()
{
var initial = 0;
stop = Math.round($(window).scrollTop());
if (initial < 1)
{
if (stop > 740)
{
initial = initial + 1;
$('#main_nav').addClass('past-scrollpoint');
$('#content-block').addClass('past-scrollpoint-content');
$('#header').addClass('hidden');
}
}
);