Use nanoscroller to allow intro doc scrolling

This commit is contained in:
Nick Winter 2015-11-15 08:23:12 -08:00
parent 31a13d69b3
commit 0abb9a38ad
3 changed files with 10 additions and 6 deletions
app
styles/play/level
templates/play/level
views/play/level

View file

@ -89,8 +89,7 @@ $UNVEIL_TIME: 1.2s
.intro-doc
text-align: left
font-size: 16px
//overflow-y: scroll // bad scroll bars
overflow: hidden
//overflow-y: scroll // using nanoscroller now
img
max-width: 100%

View file

@ -10,7 +10,10 @@
.errors
.intro-doc
.intro-doc.hidden
.nano
.nano-content
.intro-doc-content
.progress-or-start-container
button.start-level-button.btn.btn-lg.btn-success.btn-illustrated.header-font.needsclick(data-i18n="play_level.loading_start") Start Level

View file

@ -155,8 +155,10 @@ module.exports = class LevelLoadingView extends CocoView
minHeight = $('#code-area').outerHeight(true)
@$el.css height: maxHeight
@$loadingDetails.css minHeight: minHeight, maxHeight: maxHeight
$intro = @$el.find('.intro-doc')
$intro.css maxHeight: minHeight - $intro.offset().top - @$el.find('.progress-or-start-container').outerHeight() - 30 - 20
if @intro
$intro = @$el.find('.intro-doc')
$intro.css height: minHeight - $intro.offset().top - @$el.find('.progress-or-start-container').outerHeight() - 30 - 20
$intro.find('.nano').nanoScroller alwaysVisible: true
unveilWings: (duration) ->
@playSound 'loading-view-unveil', 0.5
@ -167,7 +169,7 @@ module.exports = class LevelLoadingView extends CocoView
unveilIntro: =>
return if @destroyed or not @intro or @unveiled
html = marked utils.filterMarkdownCodeLanguages(utils.i18n(@intro, 'body'))
@$el.find('.intro-doc').html html
@$el.find('.intro-doc').removeClass('hidden').find('.intro-doc-content').html html
@resize()
onUnveilEnded: =>