@madj2k/fe-frontend-kit 2.0.19 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/readme.md +1 -1
- package/tools/scrolling/scrolling-2.0.js +5 -5
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -168,7 +168,7 @@ Init with available options:
|
|
|
168
168
|
import { Madj2kScrolling } from '@madj2k/frontend-kit/tools/scrolling';
|
|
169
169
|
const scrolling = new Madj2kScrolling({
|
|
170
170
|
anchorScrolling: {
|
|
171
|
-
selector: ['a[href^="#"]'],
|
|
171
|
+
selector: ['a[href^="#"]', 'a[href*="#"]'],
|
|
172
172
|
offsetSelector: null,
|
|
173
173
|
disableSelector: '.js-no-scroll',
|
|
174
174
|
collapsibleSelector: ['.collapse'],
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* @author Steffen Kroggel <developer@steffenkroggel.de>
|
|
14
14
|
* @copyright 2025 Steffen Kroggel
|
|
15
|
-
* @version 2.0.
|
|
15
|
+
* @version 2.0.4
|
|
16
16
|
* @license GNU General Public License v3.0
|
|
17
17
|
* @see https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
18
18
|
*
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* // Initialize with custom config
|
|
25
25
|
* const scrolling = new Madj2kScrolling({
|
|
26
26
|
* anchorScrolling: {
|
|
27
|
-
* selector: ['a[href*="#"]'],
|
|
27
|
+
* selector: ['a[href^="#"]', 'a[href*="#"]'],
|
|
28
28
|
* offsetSelector: null,
|
|
29
29
|
* disableSelector: '.js-no-scroll',
|
|
30
30
|
* collapsibleSelector: ['.collapse'],
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
class Madj2kScrolling {
|
|
74
74
|
config = {
|
|
75
75
|
anchorScrolling: {
|
|
76
|
-
selector: ['a[href*="#"]'],
|
|
76
|
+
selector: ['a[href^="#"]', 'a[href*="#"]'],
|
|
77
77
|
offsetSelector: null,
|
|
78
78
|
disableSelector: '.js-no-scroll',
|
|
79
79
|
collapsibleSelector: ['.collapse'],
|
|
@@ -235,8 +235,8 @@ class Madj2kScrolling {
|
|
|
235
235
|
const href = event.currentTarget.getAttribute('href');
|
|
236
236
|
if (!href) return;
|
|
237
237
|
|
|
238
|
-
const url = new URL(href, window.location.origin); //
|
|
239
|
-
const isSamePage = url.pathname === window.location.pathname;
|
|
238
|
+
const url = new URL(href, window.location.origin); // also converts relative URLs correctly
|
|
239
|
+
const isSamePage = (url.pathname === window.location.pathname || href.startsWith("#"));
|
|
240
240
|
|
|
241
241
|
if (isSamePage && url.hash) {
|
|
242
242
|
event.preventDefault();
|