spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[livejournal] r21788: LJSUP-11891: Like buttons on the journal...

Committer: atyurin
LJSUP-11891: Like buttons on the journal pages should be loaded only when they become visible on the screen.
fixed firefox bug
U   trunk/htdocs/js/journal.js
Modified: trunk/htdocs/js/journal.js
===================================================================
--- trunk/htdocs/js/journal.js	2012-04-24 07:50:06 UTC (rev 21787)
+++ trunk/htdocs/js/journal.js	2012-04-24 08:19:10 UTC (rev 21788)
@@ -401,6 +401,7 @@
 /**
 * delayed like buttons loader
 */
+
 (function() {
 	var likePos = [];
 
@@ -409,7 +410,7 @@
 		likePos = jQuery('.lj-like').map(function() {
 			return {
 				el: this,
-				top: jQuery(this).position().top,
+				top: jQuery(this).offset().top,
 				init: false
 			};
 		}).toArray();
@@ -427,7 +428,7 @@
 
 				toInit = likePos.filter(function(like) {
 					return (!like.init &&
-							 like.top > scrollTop &&
+							 like.top > scrollTop - 100 &&
 							 like.top < scrollTop + windowHeight + 200);
 				});
 
@@ -435,7 +436,6 @@
 				var jEl = jQuery(like.el),
 					likeHtml = jEl.html();
 				
-
 				jEl.html(likeHtml.slice(4, -3)); // strip '<!--' and '-->'
 				LiveJournal.parseLikeButtons();
 

Tags: atyurin, js, livejournal, spacevillain
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments