@madj2k/fe-frontend-kit 2.0.19 → 2.0.21
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
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'],
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @author Steffen Kroggel <developer@steffenkroggel.de>
|
|
19
19
|
* @copyright 2025 Steffen Kroggel
|
|
20
|
-
* @version 2.0.
|
|
20
|
+
* @version 2.0.2
|
|
21
21
|
* @license GNU General Public License v3.0
|
|
22
22
|
* @see https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
23
23
|
*
|
|
@@ -138,6 +138,7 @@ class Madj2kOwlThumbnail {
|
|
|
138
138
|
this._highlightInitialThumb(event);
|
|
139
139
|
this._equalizeThumbnailHeights();
|
|
140
140
|
this._repositionThumbNav();
|
|
141
|
+
this._updateArrowNav()
|
|
141
142
|
},
|
|
142
143
|
onRefreshed: () => {
|
|
143
144
|
this._equalizeThumbnailHeights();
|
|
@@ -260,7 +261,8 @@ class Madj2kOwlThumbnail {
|
|
|
260
261
|
this._log('Centering thumbnails to index:', centerIndex);
|
|
261
262
|
this.$thumbs.trigger('to.owl.carousel', [centerIndex, 300, true]);
|
|
262
263
|
|
|
263
|
-
this._repositionThumbNav(index
|
|
264
|
+
this._repositionThumbNav(index);
|
|
265
|
+
this._updateArrowNav(index)
|
|
264
266
|
this.syncing = false;
|
|
265
267
|
}
|
|
266
268
|
|
|
@@ -299,7 +301,8 @@ class Madj2kOwlThumbnail {
|
|
|
299
301
|
if ($(e.currentTarget).hasClass('owl-prev')) {
|
|
300
302
|
// Previous slide in main carousel
|
|
301
303
|
newIndex = mainData.relative(mainData.current()) - 1;
|
|
302
|
-
if (newIndex < 0)
|
|
304
|
+
if (newIndex < 0) newIndex = 0; // no loop
|
|
305
|
+
|
|
303
306
|
} else if ($(e.currentTarget).hasClass('owl-next')) {
|
|
304
307
|
// Next slide in main carousel
|
|
305
308
|
newIndex = mainData.relative(mainData.current()) + 1;
|
|
@@ -310,6 +313,29 @@ class Madj2kOwlThumbnail {
|
|
|
310
313
|
});
|
|
311
314
|
}
|
|
312
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Updates the visibility of the navigation arrows based on the current index
|
|
318
|
+
*
|
|
319
|
+
* @param index
|
|
320
|
+
* @private
|
|
321
|
+
*/
|
|
322
|
+
_updateArrowNav (index = 0) {
|
|
323
|
+
|
|
324
|
+
const mainData = this.$main.data('owl.carousel');
|
|
325
|
+
if (!mainData) return;
|
|
326
|
+
|
|
327
|
+
this.$thumbs.find('.owl-prev').removeClass('inactive');
|
|
328
|
+
this.$thumbs.find('.owl-next').removeClass('inactive');
|
|
329
|
+
|
|
330
|
+
if (index === 0) {
|
|
331
|
+
this.$thumbs.find('.owl-prev').addClass('inactive');
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (index === mainData.items().length -1) {
|
|
335
|
+
this.$thumbs.find('.owl-next').addClass('inactive');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
313
339
|
/**
|
|
314
340
|
* Start thumbnails on the left side of the stage, even if they are centered!
|
|
315
341
|
* @private
|
|
@@ -328,11 +354,11 @@ class Madj2kOwlThumbnail {
|
|
|
328
354
|
$thumbStage.css('transform', 'translate3d(0px, 0px, 0px)');
|
|
329
355
|
this._log('Thumb stage repositioned: left-aligned (index 0)');
|
|
330
356
|
|
|
331
|
-
|
|
357
|
+
// last thumb aligned right
|
|
332
358
|
} else if (currentIndex === lastIndex) {
|
|
333
359
|
let totalWidth = 0;
|
|
334
360
|
$thumbItems.each((i, item) => {
|
|
335
|
-
totalWidth += $(item).outerWidth(true); //
|
|
361
|
+
totalWidth += $(item).outerWidth(true); // margin included
|
|
336
362
|
});
|
|
337
363
|
|
|
338
364
|
const containerWidth = this.$thumbs.width();
|
|
@@ -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();
|