[fix] remember scroll position for baggy theme #519

This commit is contained in:
Nicolas Lœuillet 2014-03-06 18:57:04 +01:00
parent 4ca17924a1
commit 25114854b3
1 changed files with 19 additions and 0 deletions

View File

@ -29,4 +29,23 @@
{{ content | raw }}
</article>
</div>
<script src="{{ poche_url }}/themes/{{theme}}/js/restoreScroll.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
var docHeight = $(document).height();
var scrollPercent = (scrollTop) / (docHeight);
var scrollPercentRounded = Math.round(scrollPercent*100)/100;
savePercent({{ entry.id|e }}, scrollPercentRounded);
});
retrievePercent({{ entry.id|e }});
$(window).resize(function(){
retrievePercent({{ entry.id|e }});
});
});
</script>
{% endblock %}