option to adjust documentElement#821
Conversation
This option lets the user change the DocumentElement if the default value (whole document) can't be used. It's possible to either set 'target' (what will use the internal scope_Target) or a custom element. Fallback is the whole document.
|
This looks good. I'm really sorry for not replying earlier; I've been travelling for a while. I'll soon push some changes to this pull request to add some comments detailing why some changes were made and remove the distributed files. Thanks! |
|
Thanks for your response! |
|
@leongersen I just came back to this feature because I need it for a new project and would like to avoid to adjust my vendors locally again. Do you have time to finish & merge this PR? |
|
Sorry I never got back to this! I am not sure about an option to replace the document element, as a lot of events (e.g. |
# Conflicts: # distribute/nouislider.css # distribute/nouislider.js # distribute/nouislider.min.css # distribute/nouislider.min.js # src/js/options.js
|
@leongersen the new option does not affect any existing project and is meant to be used in cases where the default documentElement does not work (e.g. when using the Off-Canvas plugin of the Foundation framework as mentioned above). Here's a simple codepen to show the problem and how it's fixed using the new option. I've merged dev into my feature branch so my PR is (again) ready to merge. |
Any comment from you beside the link would be helpful. The mentioned 'bugfix' on stackoverflow is no fix because the option in talk ( The only solution so far is the additional option, introduced by this PR. |
|
I just released noUiSlider 12.0.0, which adds this option. I did not include the |
I've had a great problem with the noUiSlider when using it inside of an Off-Canvas component (foundation-sites framework) with the option
contentScroll:false.Precisely the slider didn't move on touchmove.
After digging through the noUiSlider sources I've found out the reason:
the slider is listening on
scope_DocumentElementwhat is always the whole document. But since the Off-Canvas is preventing all touch on the body the slider doesn't work anymore.To fix this you have to change
scope_DocumentElementfrom document to some element in the Off-Canvas. Unfortunately there's hasn't been an option to adjust that variable.That's why I've made this PR which provides an option to adjust it.
You can either pass an element or a string with value
target(will internally usescope_Targetthen). Fallback is document so 100% backwards compatibility is guaranteed.@leongersen would you please review and merge if it's ok for you?