We have scrolling, and resetting before we load.
This commit is contained in:
parent
b10ed90e85
commit
1580eecb26
1 changed files with 26 additions and 9 deletions
35
sahli.coffee
35
sahli.coffee
|
|
@ -67,12 +67,14 @@ class @Sahli
|
||||||
if req.status == 200 or req.status == 0
|
if req.status == 200 or req.status == 0
|
||||||
ptxt.text @responseText
|
ptxt.text @responseText
|
||||||
inserthere.after pdiv
|
inserthere.after pdiv
|
||||||
|
$('body').scrollTop(0)
|
||||||
else
|
else
|
||||||
@loaderror inserthere, fname, req.statusText, req.status
|
@loaderror inserthere, fname, req.statusText, req.status
|
||||||
req.open 'GET', fname, true
|
req.open 'GET', fname, true
|
||||||
req.send null
|
req.send null
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@loadansi = (picdata, inserthere) ->
|
@loadansi = (picdata, inserthere) ->
|
||||||
fname = @location + '/' + picdata.file
|
fname = @location + '/' + picdata.file
|
||||||
pdiv = $('<div>')
|
pdiv = $('<div>')
|
||||||
|
|
@ -128,12 +130,9 @@ class @Sahli
|
||||||
@nextpic = =>
|
@nextpic = =>
|
||||||
viewbox = $('div#sahliviewer')
|
viewbox = $('div#sahliviewer')
|
||||||
viewbox.children().remove()
|
viewbox.children().remove()
|
||||||
# reset scrolling;
|
$('body').stop()
|
||||||
# @stopscroll()
|
$('body').scrollTop(0)
|
||||||
# @scroll_direction = 1
|
@scroll_direction = 1
|
||||||
|
|
||||||
# and we are here.
|
|
||||||
|
|
||||||
i = @currentpic
|
i = @currentpic
|
||||||
filedata = @filedata
|
filedata = @filedata
|
||||||
filedata[i].pic = $('<h6>' + filedata[i].file + '</h6>')
|
filedata[i].pic = $('<h6>' + filedata[i].file + '</h6>')
|
||||||
|
|
@ -162,8 +161,6 @@ class @Sahli
|
||||||
docElm.webkitRequestFullScreen Element.ALLOW_KEYBOARD_INPUT
|
docElm.webkitRequestFullScreen Element.ALLOW_KEYBOARD_INPUT
|
||||||
@fullscreen = true
|
@fullscreen = true
|
||||||
|
|
||||||
@cancelfullscreen = ->
|
|
||||||
|
|
||||||
@toggledebug = ->
|
@toggledebug = ->
|
||||||
$('h1#top').fadeToggle()
|
$('h1#top').fadeToggle()
|
||||||
@DEBUG = !@DEBUG
|
@DEBUG = !@DEBUG
|
||||||
|
|
@ -181,6 +178,22 @@ class @Sahli
|
||||||
errstr = "error! #{errortext} / code #{errorcode}"
|
errstr = "error! #{errortext} / code #{errorcode}"
|
||||||
inserthere.after $("<h1>").text("#{errstr}")
|
inserthere.after $("<h1>").text("#{errstr}")
|
||||||
|
|
||||||
|
@setscroll = ->
|
||||||
|
scrollbox = $('body')
|
||||||
|
bottom = $('body').height()
|
||||||
|
scrollto = bottom
|
||||||
|
# kill animations from before
|
||||||
|
scrollbox.stop true
|
||||||
|
if @scroll_direction == 1
|
||||||
|
@scroll_direction = -1
|
||||||
|
steps = bottom - scrollbox.scrollTop()
|
||||||
|
else
|
||||||
|
@scroll_direction = 1
|
||||||
|
scrollto = 0
|
||||||
|
steps = scrollbox.scrollTop()
|
||||||
|
console.log "#{@scroll_speed} | #{steps}"
|
||||||
|
scrollbox.animate { scrollTop: scrollto }, @scroll_speed * steps, 'linear'
|
||||||
|
|
||||||
@loadkeys = ->
|
@loadkeys = ->
|
||||||
$(document).on('keydown', (ev) =>
|
$(document).on('keydown', (ev) =>
|
||||||
switch ev.which
|
switch ev.which
|
||||||
|
|
@ -189,7 +202,11 @@ class @Sahli
|
||||||
when @keycode('f')
|
when @keycode('f')
|
||||||
@togglefullscreen()
|
@togglefullscreen()
|
||||||
when @keycode('s')
|
when @keycode('s')
|
||||||
alert("not spaaaace")
|
@setscroll()
|
||||||
|
when @keycode('t')
|
||||||
|
$('body').scrollTop(0)
|
||||||
|
when 8 # backspace
|
||||||
|
$('body').stop()
|
||||||
else
|
else
|
||||||
console.log ev.which
|
console.log ev.which
|
||||||
)
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue