diff options
| author | 2013-07-26 18:03:20 +0200 | |
|---|---|---|
| committer | 2013-07-26 18:03:20 +0200 | |
| commit | 4a78d880b7f12426ead42fc352e5f2c2d0d04f9d (patch) | |
| tree | e5d4c1f44993d95736405ffb5bfe9648d21140d7 /app/views/javascript | |
| parent | 126421b5e9c98e5d9698232fc4c21cba04403dbd (diff) | |
Fix issues #98 #99 : marquage lors du défilement
Modification de la zone du viewport qui faisait toute la taille de
l'écran. Désormais le viewport va du haut de l'écran jusqu'à sa moitié
Modification de la zone de marquage en la réduisant : début au 3/4 de
l'article et fin 50px plus loin (ou bas de l'article si dépasse)
Diffstat (limited to 'app/views/javascript')
| -rw-r--r-- | app/views/javascript/main.phtml | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 9226efe63..5eb4aaa99 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -144,15 +144,14 @@ function inMarkViewport(flux) { var top = flux.position().top; var height = flux.height(); var begin = top + 3 * height / 4; - var bot = top + height; + var bot = Math.min(begin + 75, top + height); var windowTop = $(window).scrollTop(); - var windowBot = windowTop + $(window).height(); + var windowBot = windowTop + $(window).height() / 2; return (windowBot >= begin && windowBot <= bot); } -var lastScroll = 0; function init_posts () { init_img (); <?php if($this->conf->lazyload() == 'yes') { ?> @@ -197,17 +196,9 @@ function init_posts () { <?php } ?> <?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') && - $(this).children(".flux_content").is(':visible') && + $('.flux.not_read:visible').each(function() { + if($(this).children(".flux_content").is(':visible') && inMarkViewport($(this))) { mark_read($(this), true); } |
