2021-07-05 03:19:04 +00:00
|
|
|
import { store } from '../store.js'
|
2018-12-16 18:22:34 +00:00
|
|
|
|
2019-08-03 20:49:37 +00:00
|
|
|
const theScrollbarStyle = process.browser && document.getElementById('theScrollbarStyle')
|
2018-11-28 03:17:18 +00:00
|
|
|
|
2018-12-16 18:22:34 +00:00
|
|
|
export function customScrollbarObservers () {
|
2018-11-28 03:17:18 +00:00
|
|
|
store.observe('disableCustomScrollbars', disableCustomScrollbars => {
|
|
|
|
if (!process.browser) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// disables or enables the style
|
|
|
|
theScrollbarStyle.setAttribute('media', disableCustomScrollbars ? 'only x' : 'all')
|
2022-11-19 19:25:42 +00:00
|
|
|
}, { init: false }) // init:false because the inline script takes care of it
|
2018-11-28 03:17:18 +00:00
|
|
|
}
|