Skip to content
Snippets Groups Projects
Commit 28ba985e authored by Robert Schilling's avatar Robert Schilling
Browse files

Save last scrollposition and scroll back when leaving ZEN mode

parent 90741c88
No related branches found
No related tags found
1 merge request!7815Save last scrollposition and scroll back when leaving ZEN mode
Loading
Loading
@@ -4,10 +4,16 @@ class @ZenMode
constructor: ->
@active_zen_area = null
@active_checkbox = null
@scroll_position = 0
$(window).scroll =>
if not @active_checkbox
@scroll_position = window.pageYOffset
 
$('body').on 'change', '.zennable input[type=checkbox]', (e) =>
checkbox = e.currentTarget
if checkbox.checked
# Disable other keyboard shortcuts in ZEN mode
Mousetrap.pause()
@udpateActiveZenArea(checkbox)
else
Loading
Loading
@@ -34,6 +40,7 @@ class @ZenMode
@active_zen_area = null
@active_checkbox = null
window.location.hash = ''
window.scrollTo(window.pageXOffset, @scroll_position)
 
checkboxFromLocationHash: (e) ->
id = $.trim(window.location.hash.replace('#' + ZenMode.fullscreen_prefix, ''))
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment