加载时淡入图像

Fade-in images on load

本文关键字:图像 淡入 加载      更新时间:2023-09-26

我有这个:

<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 -->

但是图库加载程序不显示?我似乎想不通。

非常感谢您的帮助。

你在用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);

});

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

希望这能有所帮助。