2010-05-08 104 views

回答

0

他們的代碼是直接在頁面中。在CSS中進行一些調查應該會讓你朝正確的方向發展。

$(document).ready(function() { 

    var nrgtiles = $('div[class^=homesplash]').length; 

/* alert(nrgtiles); */ 

    $('body').append('<div id="nrgrotate">&nbsp;</div>'); 

    var i=1; 

    while (i<=nrgtiles) { 

    $('#nrgrotate').append('<a href="#"><em>&nbsp;</em></a>'); 

    i++; 
    } 

    $('#nrgrotate a:eq(0)').addClass('active'); 

    $('#nrgrotate a:eq(0)').click(function() { 

    homeFadeOut(); 

    return false; 

    }); 

    $('#nrgrotate a:eq(1)').click(function() { 

    homeFadeIn(); 

    return false; 

    }); 

    $('.homesplash2').hide(); 

    timer = setTimeout(homeFadeIn, 10000); 

}); 

function homeFadeIn() { 

    clearTimeout(timer); 

    $('#nrgrotate a:eq(0)').removeClass('active'); 
    $('#nrgrotate a:eq(1)').addClass('active'); 

    $('.homesplash2').fadeIn(1000, function() { 

    timer = setTimeout(homeFadeOut, 10000); 

    }); 

} 

function homeFadeOut() { 

    clearTimeout(timer); 

    $('#nrgrotate a:eq(1)').removeClass('active'); 
    $('#nrgrotate a:eq(0)').addClass('active'); 

    $('.homesplash2').css('margin-top', '-263px').fadeOut(1000, function() { 

    timer = setTimeout(homeFadeIn, 10000); 

    }); 

} 
+0

謝謝。將研究它。 – Victor 2010-05-09 10:40:25