/
githubmirror
/
fullPage.js
Обзор
Документация
Войти
/
githubmirror
/
fullPage.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/js/scroll/scrollToAnchor.js
25 строк
841 B
Alvaro Trigo López
- Fixed bug: Loading page with anchors shows wrong section/slide when using scrollOverflow #4464
16 сен 2022, 15:29
16 сен 2022, 15:29
20374f9
Код
Авторство
О чём код?
import { getOptions } from '../common/options.js'; import { getAnchorsURL } from '../anchors/getAnchorsURL.js'; import { scrollPageAndSlide } from './scrollPageAndSlide.js'; import { silentMoveTo } from './silentMove.js'; import { EventEmitter } from '../common/eventEmitter.js'; import { events } from '../common/events.js'; /** * Scrolls to the anchor in the URL when loading the site */ export function scrollToAnchor(){ var anchors = getAnchorsURL(); var sectionAnchor = anchors.section; var slideAnchor = anchors.slide; if(sectionAnchor){ //if theres any # if(getOptions().animateAnchor){ scrollPageAndSlide(sectionAnchor, slideAnchor); }else{ silentMoveTo(sectionAnchor, slideAnchor); } }else{ EventEmitter.emit(events.onAfterRenderNoAnchor, null); } }