• Hello! So I’m using JQuery to cycle through images on my home screen, but they fade to white instead of from one image to the next. When I’ve found tutorials showing how to fade from one to the next, they’re frequently working with html files, but seeing as wordpress is mostly .php, I really don’t know how to utilize those examples…. Is there any way I can edit the code below to make it have the action I wish?

    Here is the site:
    http://www.tcinteriors.org

    The code:

    jQuery(document).ready(function($) {		
    
    var initialBg =  $('body.home').css("http://belynchdesign.com/tcinteriors/wp-content/uploads/2014/04/beachbed.jpg"); // added
    
    var firstTime = true;
    var arr = [initialBg, "url(http://belynchdesign.com/tcinteriors/wp-content/uploads/2014/04/beachy2.jpg)", "url(http://belynchdesign.com/tcinteriors/wp-content/uploads/2014/04/bluetan3.jpg)"]; // changed
        (function recurse(counter) {
            var bgImage = arr[counter];
            if (firstTime == false) {
                $("body.home").fadeOut("slow", function(){
                    $('body.home').css('background-image', bgImage); // fixed
                });
                $("body.home").fadeIn("slow");
            } else {
                firstTime = false;
            }
            delete arr[counter];
            arr.push(bgImage);
            setTimeout(function() {
                recurse(counter + 1);
            }, 1000);
        })(0);      
    
    	});

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JQuery Question’ is closed to new replies.