henrygd / bigpicture

Lightweight JavaScript image / video viewer. Supports Youtube, Vimeo, etc.
https://henrygd.me/bigpicture
MIT License
818 stars 76 forks source link

Hide scrollbar #20

Closed raRaRa closed 5 years ago

raRaRa commented 5 years ago

Hi,

Is it possible to hide the scrollbars when bigpicture is open?

Thanks.

henrygd commented 5 years ago

Just added an onClose callback to allow you to do this. Example to disable scrolling:

BigPicture({
  el: this,
  animationStart: function() {
    document.documentElement.style.overflowY = 'hidden'
    document.body.style.overflowY = 'scroll'
  },
  onClose: function() {
    document.documentElement.style.overflowY = 'auto'
    document.body.style.overflowY = 'auto'
  }
})

or if you just want to completely remove the scrollbar:

BigPicture({
  el: this,
  animationStart: function() {
    document.documentElement.style.overflow = 'hidden'
  },
  onClose: function() {
    document.documentElement.style.overflow = 'auto'
  }
})