加载时淡入图像

时间:2012-03-19 16:08:44

标签: javascript jquery css

我有这个:

<div id="container" class="loading">
<header id="gallery-header">
    <div id="top-bar-gallery">
        <a href="../index.html">HOME</a>
    </div>
</header>
<div id="gallery-main" role="main" >
    <div id="image" class="loading">
    <a><img src="roma/roma2.jpg" alt"" /></a>
        <a><img src="../css/images/gallery-loaderx.gif" alt="" /></a>
    </div>
</div>
</div> <!--! end of #container -->

但画廊装载机没有显示?我似乎无法解决这个问题。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

你在使用任何JS吗?或者在页面加载后你需要一些淡入淡出图像的解决方案吗? 如果你只需要fadeIn的图像/内容,你需要包含Jquery然后做这样的事情:

$(document).ready(function() {

    //hides the images
    $("#images").hide();

    // starts a time counter so you can fade the images later on (when page loads)
    var imageFader= setTimeout(function(){  
         $("#images").fadeIn();

    },2000); // 2 seconds (adjust if needed);


});

您也可以应用此方法来触发/激活功能

希望这有帮助。

相关问题