diff options
| author | 2013-06-23 20:25:21 +0200 | |
|---|---|---|
| committer | 2013-06-23 20:25:21 +0200 | |
| commit | 9758d1d7366519ce17c052928a78bef76216f02a (patch) | |
| tree | ea18d81e9dd36d5560bd40d3df1082b5e427c1f4 /app/views/javascript | |
| parent | c0700b80fd5b07e7d609024219cfe14a4ed43e52 (diff) | |
Amélioration du marquage au défilement
Ne marque plus que lorsqu'on s'est déplacé de plus de 50px (évite de
checker à chaque fois)
De plus, lorsque les articles sont repliés, le marquage ne marche plus
(évite donc de marquer des articles non lus)
Diffstat (limited to 'app/views/javascript')
| -rw-r--r-- | app/views/javascript/main.phtml | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index da95f9c04..b3da278bc 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -152,6 +152,7 @@ function inMarkViewport(flux) { return (windowBot >= begin && windowBot <= bot); } +var lastScroll = 0; function init_posts () { init_img (); <?php if($this->conf->lazyload() == 'yes') { ?> @@ -196,8 +197,16 @@ function init_posts () { <?php if ($mark['scroll'] == 'yes') { ?> var flux = $('.flux'); $(window).scroll(function() { + var windowTop = $(this).scrollTop(); + if(Math.abs(windowTop - lastScroll) <= 50) { + return; + } + lastScroll = windowTop; + flux.each(function() { - if($(this).hasClass('not_read') && inMarkViewport($(this))) { + if($(this).hasClass('not_read') && + $(this).children(".flux_content").is(':visible') && + inMarkViewport($(this))) { mark_read($(this), true); } }); |
