Comments on: Image Loading http://jqueryfordesigners.com/image-loading/ Tutorials and screencasts Thu, 22 Sep 2011 12:58:42 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: DJ Vermeulen http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7884 DJ Vermeulen Fri, 02 Apr 2010 13:15:45 +0000 http://jqueryfordesigners.com/image-loading/#comment-7884 <p>Thanx. The tutorial worked great on my images, but i've got a flash (.swf) file that needs to load as well. This script doesn't seem to work on that or how must the code be changed to accommoodate a loading flash file.</p> Thanx. The tutorial worked great on my images, but i’ve got a flash (.swf) file that needs to load as well. This script doesn’t seem to work on that or how must the code be changed to accommoodate a loading flash file.

]]>
By: Ben Lacey http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7862 Ben Lacey Sat, 27 Mar 2010 01:51:12 +0000 http://jqueryfordesigners.com/image-loading/#comment-7862 <p>Very nice article, I follow your JQuery iPod podcasts and I'm always very impressed with the stuff you put together. </p> <p>I find JQuery to be really lightweight and a very useful framework for JavaScript awesomeness. Keep up the good work!</p> <p>Ben Lacey (Lacey Tech Solutions)</p> Very nice article, I follow your JQuery iPod podcasts and I’m always very impressed with the stuff you put together.

I find JQuery to be really lightweight and a very useful framework for JavaScript awesomeness. Keep up the good work!

Ben Lacey (Lacey Tech Solutions)

]]>
By: Kevin Crawford http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7765 Kevin Crawford Mon, 01 Mar 2010 14:39:49 +0000 http://jqueryfordesigners.com/image-loading/#comment-7765 <p>Sorry for the double-post, but after the same request from Estevan I decided to tackle it myself!</p> <pre> <div id="loader" class="loading"&rt; <img src="image.gif" /&rt; </div&rt; $(function() { $('#loader img').hide().load(function() { $('#loader').removeClass('loading'); $(this).fadeIn(); }); // This makes it work, even when the image is cached var src = $('#loader img').attr('src'); // Stores original src from HTML as a variable $('#loader img').attr('src', '') // Set's source to empty string $('#loader img').attr('src', src) // Sets it back to the old value // BELOW IS AN ALTERNATIVE WAY TO MAKE IT WORK FOR CACHED IMAGES $('#loader img').hide(); $(window).load( function() { $('#loader').removeClass('loading'); $('#loader img').fadeIn('slow'); }); }); </pre> <p>I only tested the two solutions in FireFox, so I'm not entirely sure how well it will work cross-browser. Hope it helps someone.</p> Sorry for the double-post, but after the same request from Estevan I decided to tackle it myself!

<div id="loader" class="loading"&rt;
    <img src="image.gif" /&rt;
</div&rt;

$(function() {
    $('#loader img').hide().load(function() {
        $('#loader').removeClass('loading');
        $(this).fadeIn();
    });

    // This makes it work, even when the image is cached
    var src = $('#loader img').attr('src'); // Stores original src from HTML as a variable
   $('#loader img').attr('src', '') // Set's source to empty string
   $('#loader img').attr('src', src) // Sets it back to the old value

    // BELOW IS AN ALTERNATIVE WAY TO MAKE IT WORK FOR CACHED IMAGES
    $('#loader img').hide();
    $(window).load( function() {
        $('#loader').removeClass('loading');
        $('#loader img').fadeIn('slow');
    });
});

I only tested the two solutions in FireFox, so I’m not entirely sure how well it will work cross-browser. Hope it helps someone.

]]>
By: Kevin Crawford http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7764 Kevin Crawford Mon, 01 Mar 2010 13:39:56 +0000 http://jqueryfordesigners.com/image-loading/#comment-7764 <p>Would it be possible to include the tag in the original markup, hide it initially with CSS or javascript (and thus displaying the spinner BG behind it instead), and fade it in once it has loaded, using load()? That way you wouldn't have to define the "src" attribute in the javascript, and it would make it unobtrusive.</p> <p>Although, I suppose for some more advanced applications of this concept, the src would need to be originate dynamically from the javascript anyways =D</p> Would it be possible to include the tag in the original markup, hide it initially with CSS or javascript (and thus displaying the spinner BG behind it instead), and fade it in once it has loaded, using load()? That way you wouldn’t have to define the “src” attribute in the javascript, and it would make it unobtrusive.

Although, I suppose for some more advanced applications of this concept, the src would need to be originate dynamically from the javascript anyways =D

]]>
By: Kyle http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7257 Kyle Mon, 18 Jan 2010 12:18:23 +0000 http://jqueryfordesigners.com/image-loading/#comment-7257 <p>Hi,</p> <p>First and foremost this is a great piece of work you have provided us with, thanks very much.</p> <p>I was wondering if you could or someone could help me with one problem Im having, I cant get the image fade to work on this page http://kylehouston.com/new/index_new.html everything else works fine.</p> <p>Thanks in advance</p> <p>Kyle</p> Hi,

First and foremost this is a great piece of work you have provided us with, thanks very much.

I was wondering if you could or someone could help me with one problem Im having, I cant get the image fade to work on this page http://kylehouston.com/new/index_new.html everything else works fine.

Thanks in advance

Kyle

]]>
By: estevan http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7253 estevan Mon, 18 Jan 2010 08:06:10 +0000 http://jqueryfordesigners.com/image-loading/#comment-7253 <p>Any suggestions on how I can implement this code without designating the image src in the javascript? I'm trying to set something up like this in Wordpress and I want it load the img from the PHP.</p> Any suggestions on how I can implement this code without designating the image src in the javascript? I’m trying to set something up like this in WordPress and I want it load the img from the PHP.

]]>
By: Benedict Raynes http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7078 Benedict Raynes Mon, 07 Dec 2009 17:01:12 +0000 http://jqueryfordesigners.com/image-loading/#comment-7078 <p>This is strange - this method works very well on a apache server located on my computer, but when I tried deploying a website written with this code on any hosting, outside server - the images either didn't show up at all or showed up severely distorted. Do you know what could be wrong?</p> This is strange – this method works very well on a apache server located on my computer, but when I tried deploying a website written with this code on any hosting, outside server – the images either didn’t show up at all or showed up severely distorted. Do you know what could be wrong?

]]>
By: Mike http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7063 Mike Wed, 02 Dec 2009 02:20:14 +0000 http://jqueryfordesigners.com/image-loading/#comment-7063 <p>Excellent! Solved the exact problem I was having. Thanks for posting this!</p> Excellent! Solved the exact problem I was having. Thanks for posting this!

]]>
By: Kevin http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-7047 Kevin Thu, 26 Nov 2009 21:38:08 +0000 http://jqueryfordesigners.com/image-loading/#comment-7047 <p>Hey - thanks for this post! I kept thinking, "isn't load only for AJAX?" and thought I was going to have to do up a whole AJAX handler in my PHP script just to swap images on the fly (I would just return the proper DOM element and swap it in...) - but this saved me the time and worked like a charm.</p> <p>I hear that swapping images is territory to tread lightly when it comes to Webkit browsers, but I'll cross that bridge when I come to it...it's good for now :D</p> <p>Take care.</p> Hey – thanks for this post! I kept thinking, “isn’t load only for AJAX?” and thought I was going to have to do up a whole AJAX handler in my PHP script just to swap images on the fly (I would just return the proper DOM element and swap it in…) – but this saved me the time and worked like a charm.

I hear that swapping images is territory to tread lightly when it comes to Webkit browsers, but I’ll cross that bridge when I come to it…it’s good for now :D

Take care.

]]>
By: David http://jqueryfordesigners.com/image-loading/comment-page-4/#comment-6889 David Mon, 02 Nov 2009 21:48:21 +0000 http://jqueryfordesigners.com/image-loading/#comment-6889 <p>Hi,</p> <p>thank you for this great tutorial. Could you just tell us how to stop the loading? Because I have to override the loading, and I can't stop the first load. So my complete callback are called 2 times and not 1....</p> <p>thank you for your help!</p> Hi,

thank you for this great tutorial. Could you just tell us how to stop the loading? Because I have to override the loading, and I can’t stop the first load. So my complete callback are called 2 times and not 1….

thank you for your help!

]]>