/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/js/sections.js
64 строки
2 KB
Alvaro Trigo López
- Fixed bug: Error on loading with anchor #4622
03 июн 2024, 19:22
03 июн 2024, 19:22
379895a
Код
Авторство
О чём код?
import * as utils from './common/utils.js'; import { getOptions } from "./common/options.js"; import { ACTIVE } from './common/selectors.js'; import { updateState } from './stateUpdates.js'; import { getState } from './common/state.js'; import { FP } from './common/constants.js'; import { addTableClass } from './common/addTableClass.js'; let startingSection = null; FP.getActiveSection = getActiveSection; export function getStartingSection(){ return startingSection; } /** * Styling vertical sections */ export function styleSection(section){ var sectionElem = section.item; var hasSlides = section.allSlidesItems.length; var index = section.index(); //if no active section is defined, the 1st one will be the default one if(!getState().activeSection && section.isVisible) { utils.addClass(sectionElem, ACTIVE); updateState(); } if(!startingSection && section.isVisible){ startingSection = getState().activeSection.item; } if(getOptions().paddingTop){ utils.css(sectionElem, {'padding-top': getOptions().paddingTop}); } if(getOptions().paddingBottom){ utils.css(sectionElem, {'padding-bottom': getOptions().paddingBottom}); } if (typeof getOptions().sectionsColor[index] !== 'undefined') { utils.css(sectionElem, {'background-color': getOptions().sectionsColor[index]}); } if (typeof getOptions().anchors[index] !== 'undefined') { sectionElem.setAttribute('data-anchor', section.anchor); } if(!hasSlides){ addTableClass(section); } } /** * Gets the active section. */ function getActiveSection(){ return getState().activeSection; } export function getSectionFromPanel(panel){ return panel.isSection ? panel : panel.parent; }