Just bear in mind that that code will "fade in" as soon as the SRC attribute is set - it won't wait for the image to load...could result in an empty box fading in, and then the image suddenly appearing when it loads.

you'll need to trigger a ".load" function for the image too; this should be possible to do outside / independently of the click or fadein (i.e. an independent function within $(document).ready by itself).

James wrote:
You need to place your content inside the callback function for
fadeOut. The callback is executed after the content is faded out.

$(document).ready(function() {
     $("#lakeview-gallery a").click(function(event) {
          $("#lakeview-placeholder").fadeOut(800, function() {
               // this content will start once the content is faded
out
               var image = $(this).attr("href");
               $("img#lakeview-placeholder").attr("src", image);
               $("#lakeview-placeholder").fadeIn(800);
               return false;
          });
     });
});

On Apr 2, 11:10 am, stinkysGTI <jesse.gr...@gmail.com> wrote:
There's a pretty simple image replacement I'm trying to do, but can't
get the current image to fadeOut, and the new one to fadeIn. There's
only 3 images to choose from and always will be. With those 2 lines
commented out, it works, just obviously without any kind of fade. I'm
fairly new to jQuery, so any help would be greatly appreciated.

$(document).ready(function() {
        $("#lakeview-gallery a").click(function(event) {
//              $("#lakeview-placeholder").fadeOut(800);
//              $("#lakeview-placeholder").fadeIn(800);
                event.preventDefault();
                var image = $(this).attr("href");
                $("img#lakeview-placeholder").attr("src", image);
                });

});

The page can be seen here:http://www.lakeshoremontana.com/dev/floorplans.html
------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.40/2039 - Release Date: 04/03/09 06:19:00


Reply via email to