Skip to content

Commit

Permalink
Adding docs on hiding scrollbars in FF
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPiscitelli committed Nov 17, 2018
1 parent 06f93eb commit dd02c8d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,38 @@ Glider.js should run on all modern browsers. Support for older browser can be ac

Include `glider-compat.min.js` to load the aforementioned polyfills

#### Native Scrollbars

Since Glider.js uses native scrolling, the browser wants to apply the standard scrollbar to the glider. In most cases, this is fine since the scrollbar can be hidden with CSS and Glider.js does so when appropriate. In browsers such as Firefox though, the scrollbars cannot be hidden with CSS and require additional markup to hide.

To hide the scrollbars in Firefox, you'll want to wrap your glider with `<div class="glider-wrap">` and apply the following CSS/JS:

```css
@-moz-document url-prefix() {
.glider-track {
margin-bottom: 17px;
}
.glider-wrap {
overflow: hidden;
}
}
```

```javascript
document.addEventListener('glider-loaded', hideFFScrollBars);
document.addEventListener('glider-refresh', hideFFScrollBars);
function hideFFScrollBars(e){
var scrollbarHeight = 17; // Currently 17, may change with updates
if(/firefox/i.test(navigator.userAgent)){
// We only need to appy to desktop. Firefox for mobile uses
// a different rendering engine (WebKit)
if (window.innerWidth > 575){
e.target.parentNode.style.height = (e.target.offsetHeight - scrollbarHeight) + 'px'
}
}
}
```

#### Dependencies

None :)
Expand Down
1 change: 1 addition & 0 deletions docs/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3891,6 +3891,7 @@ input, select, textarea {
justify-content: center;
align-items: center;
border: 1px solid #f5f5f5;
border-bottom: 0;
}
.multiple .glider-slide {
min-height: 150px;
Expand Down

0 comments on commit dd02c8d

Please sign in to comment.