diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-03-06 18:57:04 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2014-03-06 18:57:04 +0100 |
commit | 25114854b3e6b42c7be5e21a62539d8f23d3a10e (patch) | |
tree | 19c6d5b9f91e4817cb3421d9820bb17d80226548 /themes/baggy/view.twig | |
parent | 4ca17924a186b0a0571a1129c37fe48b47ce1331 (diff) | |
download | wallabag-25114854b3e6b42c7be5e21a62539d8f23d3a10e.tar.gz wallabag-25114854b3e6b42c7be5e21a62539d8f23d3a10e.tar.zst wallabag-25114854b3e6b42c7be5e21a62539d8f23d3a10e.zip |
[fix] remember scroll position for baggy theme #519
Diffstat (limited to 'themes/baggy/view.twig')
-rw-r--r-- | themes/baggy/view.twig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/themes/baggy/view.twig b/themes/baggy/view.twig index c925e91c..092be04e 100644 --- a/themes/baggy/view.twig +++ b/themes/baggy/view.twig | |||
@@ -29,4 +29,23 @@ | |||
29 | {{ content | raw }} | 29 | {{ content | raw }} |
30 | </article> | 30 | </article> |
31 | </div> | 31 | </div> |
32 | <script src="{{ poche_url }}/themes/{{theme}}/js/restoreScroll.js"></script> | ||
33 | <script type="text/javascript"> | ||
34 | $(document).ready(function() { | ||
35 | |||
36 | $(window).scroll(function(e){ | ||
37 | var scrollTop = $(window).scrollTop(); | ||
38 | var docHeight = $(document).height(); | ||
39 | var scrollPercent = (scrollTop) / (docHeight); | ||
40 | var scrollPercentRounded = Math.round(scrollPercent*100)/100; | ||
41 | savePercent({{ entry.id|e }}, scrollPercentRounded); | ||
42 | }); | ||
43 | |||
44 | retrievePercent({{ entry.id|e }}); | ||
45 | |||
46 | $(window).resize(function(){ | ||
47 | retrievePercent({{ entry.id|e }}); | ||
48 | }); | ||
49 | }); | ||
50 | </script> | ||
32 | {% endblock %} | 51 | {% endblock %} |