From 8c3bcccfcb080a7f9f045962b6db64dc9f305def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Bla=C5=BEek?= Date: Thu, 10 Feb 2022 12:47:12 +0100 Subject: [PATCH] feat: added sectionSelector --- src/scripts/Smooth.js | 2 +- src/scripts/options.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripts/Smooth.js b/src/scripts/Smooth.js index 1eba1ad9..32f872c7 100644 --- a/src/scripts/Smooth.js +++ b/src/scripts/Smooth.js @@ -707,7 +707,7 @@ export default class extends Core { addSections() { this.sections = {}; - let sections = this.el.querySelectorAll(`[data-${this.name}-section]`); + let sections = this.el.querySelectorAll(this.sectionSelector ? this.sectionSelector : `[data-${this.name}-section]`); if (sections.length === 0) { sections = [this.el]; } diff --git a/src/scripts/options.js b/src/scripts/options.js index c436165e..ac778efb 100644 --- a/src/scripts/options.js +++ b/src/scripts/options.js @@ -16,6 +16,7 @@ export const defaults = { draggingClass: 'has-scroll-dragging', smoothClass: 'has-scroll-smooth', initClass: 'has-scroll-init', + sectionSelector: null, getSpeed: false, getDirection: false, scrollFromAnywhere: false,