Mercurial > mozilla-the-big-picture
changeset 30:5ef9f73615c1
fixed a bug whereby an already-loaded image could cause the whole page to be displayed prematurely.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 06 Dec 2009 13:35:54 -0800 |
parents | d18879f4d6c0 |
children | 1f5c2c038cf5 |
files | mbp.js |
diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mbp.js Sat Nov 28 16:28:25 2009 -0500 +++ b/mbp.js Sun Dec 06 13:35:54 2009 -0800 @@ -1,7 +1,8 @@ $(window).ready( function() { var rectRegexp = /rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)/; - var loadsLeft = 0; + var smallImages = $(".mbp-entry img.small"); + var loadsLeft = smallImages.length; $("h1").mouseover( function() { $("#images").empty(); @@ -11,10 +12,8 @@ if (!$(this).hasClass("small")) $(this).remove(); }); - $(".mbp-entry img.small").each( + smallImages.each( function() { - loadsLeft++; - function onLoaded() { $("#countdown").text(--loadsLeft);