我有碼寫的,但我不知道該if
和else
零件後放什麼「setFitToSection」選項的值。我想要做的 - 每當一個部分有「四」和「積極」類我想要禁用FitToSection選項fullpage.js。 Fullpage.js有一個我正在使用的setFitToSection布爾值。這是我到目前爲止,我還需要什麼?Fullpage.js - 設置基於如果一個div有一定的階級
$(document).ready(function() {
if ($('.four').hasClass('active') === true) {
$.fn.fullpage.setFitToSection(false);
}
else {
$.fn.fullpage.setFitToSection(true);
}
});
檢查'else'一部分,你有錯字,錯過了'if'。您可以簡單地使用它來代替這種情況。 '如果($( '四 ')。hasClass(' 激活')){} 其他 { }' –