Skip to content

Commit

Permalink
Make it work with native overlay scrollbars
Browse files Browse the repository at this point in the history
  • Loading branch information
yishn committed Sep 7, 2016
1 parent 53b08e7 commit 47c0224
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions view/index.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1543,12 +1543,16 @@ function showGameChooser(restoreScrollbarPos) {
if (restoreScrollbarPos == null)
restoreScrollbarPos = true

var scrollbarPos = restoreScrollbarPos ? $('#gamechooser .gm-scroll-view').scrollTop() : 0
var $scrollContainer = $('#gamechooser .games-list')
if ($scrollContainer.hasClass('gm-scrollbar-container'))
$scrollContainer = $scrollContainer.find('.gm-scroll-view')

var scrollbarPos = restoreScrollbarPos ? $scrollContainer.scrollTop() : 0

if (!restoreScrollbarPos || restoreScrollbarPos == 'top')
scrollbarPos = 0
else if (restoreScrollbarPos == 'bottom')
scrollbarPos = $('#gamechooser .gm-scroll-view').get(0).scrollHeight
scrollbarPos = $scrollContainer.get(0).scrollHeight

closeDrawers()

Expand Down Expand Up @@ -1661,7 +1665,7 @@ function showGameChooser(restoreScrollbarPos) {

$('#gamechooser').addClass('show')
$(window).on('resize', updateSVG).trigger('resize')
$('#gamechooser .gm-scroll-view').on('scroll', updateSVG).scrollTop(scrollbarPos)
$scrollContainer.on('scroll', updateSVG).scrollTop(scrollbarPos)
}

function closeGameChooser() {
Expand Down

0 comments on commit 47c0224

Please sign in to comment.