Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Doesn't work inside a display: none !important container
Browse files Browse the repository at this point in the history
Rangeslider doesn't work if it is initialized inside a hidden container where display: none has been forced with an **!important** declaration. This way to hide elements is used by Bootstrap, HTML5 Boilerplate, ...

```css
.hidden {
  display: none !important;
}
```
```html
<div class="hidden"">
  <input type="range" />
</div>
```
This is because hiddenParentNodes[i].style.display = 'block' doesn't override important style. My fix correct this problem.
  • Loading branch information
gwarnants committed Nov 26, 2015
1 parent 147ee11 commit 35fde71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@
inlineStyle[i] = hiddenParentNodes[i].style.cssText;

// visually hide
hiddenParentNodes[i].style.display = 'block';
if (hiddenParentNodes[i].style.setProperty) {
hiddenParentNodes[i].style.setProperty('display', 'block', 'important');
} else {
hiddenParentNodes[i].style.cssText += ';display: block !important';
}
hiddenParentNodes[i].style.height = '0';
hiddenParentNodes[i].style.overflow = 'hidden';
hiddenParentNodes[i].style.visibility = 'hidden';
Expand Down

0 comments on commit 35fde71

Please sign in to comment.