-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Enhancement 1244 - Slick Arrows States #1331
Conversation
Good idea to use Concerning backwards compatibility - as far as semver is concerned, minor version changes as well as patch version changes need to be backwards compatible. |
hmm, yeh ... well it's possible to save the .scss change for 2.0, then. 🐼 |
4cfd15e
to
a5daeb6
Compare
Is this a breaking change? or just the scss part? |
it's just the scss, without that the JS has no backwards-effect, it jsut adds classes for future use. -- so it's possible to undo the .scss change and document it and wait for 2.0.0 ? :) |
Any verdict on the CSS, @kenwheeler ? :) am keen to kill this branch before it gets too old. |
Not contributing, just trying to understand the codebase better: so the slick-arrows get created no matter what, but they are hidden in the "else", if the slideCount is less than the slidesToShow, right? I'm not seeing how/where the slick-hidden class could have been added before this point. Does the removeClass('slick-hidden') need to fire in the if condition (lines 449, 450)? |
@nominalaeon thanks for having a look over!! :) -- its been a while since I committed this, and it seems like you might be correct on first glance... but then I realised it's because of the This is why it's so hard to work on Slick, hehe.... there's a billion options and methods with a billion more scenarios 😨 And just when you think you've nailed it, someone's cat ordered a slider which does backflips while on fire! :P After reviewing the code you mentioned though, I did find one thing I overlooked: |
Regarding kenwheeler#1244 (comment) there was an issue, or overlooked case, whereby arrows that were added custom would not get proper states and be hard to hide/show on breakpoints. This patch amends all arrows with state (slick-hidden), and gives them a default class of "slick-arrow" for styling/manipulation depending on slick's status.
This style is for handling when a breakpoint hits where there's less slides than we have set to show... arrows should be hidden at this point, regardless of if they are custom arrows, or dom-elements. This is non-critical, but non-backwards-compatible change, so should be added to a minor version with that mentioned.
Based on a comment from @nominalaeon I noticed there was a oversight in the unload method, any arrows which were set in the options as a jquery selector-string were being removed from the DOM and never replaced in when a slide was added/removed, or setOption was run, or the slides were filtered. Fixed.
72fee79
to
adfbfd1
Compare
Just rebased from |
@@ -2400,10 +2420,13 @@ | |||
|
|||
centerOffset = Math.floor(_.options.slidesToShow / 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this line of code do?
centerOffset is not used anywhere else in the function, and it's not part of a closure either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep comments relevant to this delta, and not the core of the library, there are other places to do that where they won't get forgotten in time :)
I think Semantically the states are more like If that way you could have 4 states, and if you wanted the arrows to have a programatic function to toggle the arrows on and off, you could use specifically right now, i'm working on an application and the design calls for the arrows to be in a 'disabled' state while the arrow would scroll to out of range content, so they need to be visible, but disabled even though your current class would be you also need to update the currently i'm working on a patch in code that can extend the prototype, but i wish there was a better way than this, in situations where i don't want to modify the core library, but want to change how it works. Here is how i am doing it now, but doing it this way I can't modify the prototype until after the lib inits on the elements.
I might be able to do a PR on the lib to show you how I end up solving it without having to extend the library. I think you can add the other states now, without a huge version number as long as the current states stick around until you are able to version them out. |
There's a much larger debate here, and I don't think it is relevant to this specific PR; You suggestions are relevant very much so to a |
Not true; have you tested this? -- can you show it in a JSFiddle? edit: actually; no need... my original JSFiddle shows clearly that is indeed working correctly on breakpoint. |
👍 |
Yo, @kenwheeler , @herrschuessler 👨 - please have a quick look over this commit, and this jsfiddle http://jsfiddle.net/simeydotme/qdgwc3gp/ to demonstrate the fix :) - should fix #1244 by adding some state classes for the arrows (when the arrows are dom objects) ...
the .scss change, though, seems like it could cause trouble for people, so we can discuss to leave it out, or bump to 1.6.0 ? - There's been a lot of fixes in the last couple of weeks, so it might not be a bad idea.
Si.