Resolves an issue with nanoscroller and initially hidden content

This commit is contained in:
Jayant Jain 2014-05-24 11:41:28 +05:30
parent 241adafad8
commit 55569ccf2f
4 changed files with 3 additions and 9 deletions

View file

@ -113,6 +113,7 @@ module.exports = class EditorLevelView extends View
button.find('> span').toggleClass('secret')
toggleTab: (e) ->
@renderScrollbar()
return unless $(document).width() <= 800
li = $(e.target).closest('li')
if li.hasClass('active')

View file

@ -114,10 +114,6 @@ module.exports = class ThangsTabView extends View
@addThangsView = @insertSubView new AddThangsView world: @world, supermodel: @supermodel
@buildInterface() # refactor to not have this trigger when this view re-renders?
renderScrollbar: ->
@$el.find('.nano').nanoScroller()
@$el.find('.nano-pane').css({'display': 'block'})
onFilterExtantThangs: (e) ->
@$el.find('#extant-thangs-filter button.active').button('toggle')
button = $(e.target).closest('button')

View file

@ -118,7 +118,8 @@ module.exports = class CocoView extends Backbone.View
@renderScrollbar()
renderScrollbar: ->
@$el.find('.nano').nanoScroller()
#Defer the call till the content actually gets rendered, nanoscroller requires content to be visible
_.defer => @$el.find('.nano').nanoScroller()
updateProgress: (progress) ->
@loadProgress.progress = progress if progress > @loadProgress.progress

View file

@ -35,10 +35,6 @@ module.exports = class RootView extends CocoView
$el ?= @$el.find('.main-content-area')
super($el)
renderScrollbar: ->
$('.nano-pane').css('display','none')
$ -> $('.nano').nanoScroller()
afterInsert: ->
# force the browser to scroll to the hash
# also messes with the browser history, so perhaps come up with a better solution