Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakpoints apply to all sliders, not just the one specified #205

Closed
mattisherwood opened this issue Apr 20, 2018 · 14 comments
Closed

Breakpoints apply to all sliders, not just the one specified #205

mattisherwood opened this issue Apr 20, 2018 · 14 comments
Labels

Comments

@mattisherwood
Copy link

mattisherwood commented Apr 20, 2018

the breakpoint rules are applied to all sliders on the page, not just the one it's a part of.
e.g. glide1 should show 3 on desktop and 1 on mobile whilst glide2 should show 6 on desktop and 2 on mobile. However, on mobile they both show 2.

new Glide('#glide1', {
	type: 'carousel',
	perView: 3,
	breakpoints: {
		800: {
			perView: 1
		}
	}
}).mount();
new Glide('#glide2', {
	type: 'carousel',
	perView: 6,
	breakpoints: {
		800: {
			perView: 2
		}
	}
}).mount();

PS - I'm using Glide 3.0

@TFOH
Copy link

TFOH commented Apr 22, 2018

This seems similar to something i've been experiencing, in that the last declared rule is applied to all sliders. However, I noticed this whilst using the peek option. In the example below both sliders will have a peek of 30px each side

new Glide('#glide1', {
	type: 'carousel',
	perView: 1,
	peek: {
		before: 0,
		after: 0
		}
	}
}).mount();
new Glide('#glide2', {
	type: 'carousel',
	perView: 2,
	peek: {
		before: 30,
		after: 30
		}
	}
}).mount();

Glide 3.0.1 here. Sorry to muddy the waters if you feel this is unrelated, I just saw some similarities in our issues.

@mattisherwood
Copy link
Author

Possibly. If you load the page at less than 800px wide, then it works fine until you resize the browser. It could either be because those calculations are made after the resizing and therefore after the rest of the rules, or that they are just applied incorrectly (indiscriminately on all sliders).

I did try rearranging the rules so that 'type: carousel' was listed last, but the same happened. The key seems to be how breakpoints are applied on resize. (Or maybe how all inset objects are applied, if yours is the same issue).

@TFOH
Copy link

TFOH commented Apr 23, 2018

So on first page load when the viewport is below 800px the first slider shows 1 per view, and the second slider 2 per view, but then they both display 2 per view when you resize above 800px and then back to below 800px? Is that correct?

@jedrzejchalubek
Copy link
Member

I've done some research and it looks like recent 3.0.1 fix introduced this problem :(

Can someone try downgrade to version 3.0.0 and let me know if I'm right?

@TFOH
Copy link

TFOH commented Apr 24, 2018

I downgraded to 3.0.0 and that seems to have fixed the issue I was experiencing with the peek option.

@TFOH
Copy link

TFOH commented Apr 24, 2018

I tested with the OP's code on 3.0.0 and that seems to work as well now in my codepen here

@jedrzejchalubek
Copy link
Member

Should be fixed with v3.0.2 release

@TFOH
Copy link

TFOH commented Apr 24, 2018

It's working in my updated codepens

@mattisherwood
Copy link
Author

Ah thanks, the bug is fixed if I use glide.js (v3.0.2) on my dev site.
The minified version breaks the sliders though with an Uncaught TypeError: "this.root.querySelector is not a function" at "Object.mount".
I'm aware that possibly could be an install issue though. Do your minified versions work ok?

@jedrzejchalubek
Copy link
Member

Oh, @mattisherwood you are right. Uglify has broke minified version, need to investigate that.

@mattisherwood
Copy link
Author

Also, I'm getting issues in Internet Explorer (v11.371.16299.0) now where the sliders just refuse to work.

@mattisherwood
Copy link
Author

ie's debugger says "SCRIPT438: Object doesn't support property or method 'from'" and points to:

      this.slides = Array.from(this.wrapper.children).filter(function (slide) {
        return !slide.classList.contains(Glide.settings.classes.cloneSlide);
      });

@TFOH
Copy link

TFOH commented Apr 28, 2018

@mattisherwood Array.from is not supported in IE, I haven't tested it yet but you can try this polyfill from MDN

@jedrzejchalubek
Copy link
Member

jedrzejchalubek commented Apr 30, 2018

@mattisherwood Thanks for detailed bug reports 👍. Addressed this issues with v3.0.3 release.

Ah thanks, the bug is fixed if I use glide.js (v3.0.2) on my dev site.
The minified version breaks the sliders though with an Uncaught TypeError: "this.root.querySelector is not a function" at "Object.mount".
I'm aware that possibly could be an install issue though. Do your minified versions work ok?

Minified file for v3.0.3 should be working now. The configuration of the uglify in lib build script was striping too much and breaking.

ie's debugger says "SCRIPT438: Object doesn't support property or method 'from'" and points to:

I've swapped Array.from to Array.prototype.slice.call so, now, glidejs should be compatible with IE11. Please, let me know if you test it out :)

PS. I'm closing this issue for now. If you find any other problems feel free to open new topic :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants