a few updates

This commit is contained in:
John Bintz 2012-02-27 09:08:27 -05:00
parent 002fda6a6b
commit f0dd789e86
3 changed files with 19 additions and 7 deletions

View File

@ -109,8 +109,6 @@ class this.Attentive
@_slidesViewer ||= document.querySelector(@identifier) @_slidesViewer ||= document.querySelector(@identifier)
start: -> start: ->
@bodyClassList().add('loading')
if !this.isFile() if !this.isFile()
window.addEventListener('popstate', @handlePopState, false) window.addEventListener('popstate', @handlePopState, false)
@ -118,8 +116,21 @@ class this.Attentive
document.addEventListener('keydown', @handleKeyDown, false) document.addEventListener('keydown', @handleKeyDown, false)
window.addEventListener('resize', _.throttle(@calculate, 500), false) window.addEventListener('resize', _.throttle(@calculate, 500), false)
imageWait = null
imageWait = =>
wait = false
for slide in @allSlides()
for img in slide.dom.getElementsByTagName('img')
wait = true if !img.complete
if wait
setTimeout(imageWait, 100)
else
this.advanceTo(this.slideFromLocation()) this.advanceTo(this.slideFromLocation())
imageWait()
slideFromLocation: -> slideFromLocation: ->
value = if this.isFile() value = if this.isFile()
location.hash location.hash
@ -197,4 +208,5 @@ class this.Attentive
@bodyClassList().remove('loading') @bodyClassList().remove('loading')
@initialRender = false @initialRender = false
@currentWindowHeight = null
this.calculate()

View File

@ -33,8 +33,8 @@ body, html {
} }
body.loading { body.loading {
#slides-container { .slide {
opacity: 0; opacity: 0 !important;
} }
} }

View File

@ -6,6 +6,6 @@
%link{:rel => 'stylesheet', :href => 'assets/application.css', :type => 'text/css'}/ %link{:rel => 'stylesheet', :href => 'assets/application.css', :type => 'text/css'}/
%style{:type => 'text/css'}= Pygments.css %style{:type => 'text/css'}= Pygments.css
= haml :"_header" = haml :"_header"
%body %body.loading
= yield = yield