contao-components / swipe

JavaScript touch slider with additional dot menu
5 stars 2 forks source link

swipe.js is spamming console #1

Closed fbasara-loft48 closed 5 years ago

fbasara-loft48 commented 7 years ago

2017-04-07 10:27:21.668 swipe.min.js:2 Uncaught TypeError: Cannot read property 'getAttribute' of undefined at HTMLAnchorElement.O.next (swipe.min.js:2)

Error message happens if clicked on navigation button (prev, next) or on it's own after a few seconds.

No additional configuration outside of the content element has been done to the structure or JS. Any workaround for this?

leofeyer commented 7 years ago

Which browser are you using?

fbasara-loft48 commented 7 years ago

@leofeyer Google Chrome 57.0.2987.133 (64-bit) on macOS 10.12.4

leofeyer commented 7 years ago

I cannot reproduce the issue in the online demo.

bohnmedia commented 5 years ago

This bug still exists. You can reproduce it in the online demo after resizing the window, when the slider contains only two elements.

image

bohnmedia commented 5 years ago

Changing line 192 from

for (var i=0; i<length; i++) {

to

for (var i=0; i<nodes.dots.children.length; i++) {

in /assets/swipe/js/swipe.js solved the problem.

swipe.js.modified.zip

leofeyer commented 5 years ago

length is a global variable in the function scope and should be set to slides.length (see line 55). And slide.length should be the same as nodes.dots.children.length.

Can you please check if this is the case in your installation?

bohnmedia commented 5 years ago

The problem is, that the slides are getting cloned in case of two slides.

image

So the slides length and dots length arent equal anymore.

leofeyer commented 5 years ago

Fixed in ff0d34dcee2c7e1377e503b9e51230ca850a3124. @bohnmedia Thank you for helping us fix this one eventually. 👍