如何使用jQuery在加载时缓慢淡出图像 [英] How to slowly FadeOut an image ON LOAD using jQuery

查看:106
本文介绍了如何使用jQuery在加载时缓慢淡出图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望图像在加载时逐渐淡出.想法是,您单击进入我的网站后,我的名字会短暂停留在我的主页上,就像我的简介页上出现的视觉回声一样.

I want to have an image fade out slowly on load. Idea is that my name, which you click to enter my site, stays briefly on my homepage, like a visual echo from my intro page.

我确定这是一个小问题,但是我是编码的新手,所以我很努力.

I'm sure its a snitch, but I'm new to coding and so I am struggling.

我收集到我需要具有CSS可见性:hidden; (不确定是否需要将其放在jquery中或在实际的CSS中,或同时放在两者中),因为我希望页面上的其他元素在图像完全消失时不会跳转.

I've gleaned that I need to have css visibility:hidden; (not sure if I need to put this in the jquery or in the actual css, or both) as I want the other elements on my page not to jump when image fully dissappears.

NB在jsfiddle中用图像替换了文字

NB have substituted image for text in the jsfiddle

http://jsfiddle.net/cress/BdHmG/1/

推荐答案

尝试一下:

$(document).ready(function(){     
    $('#namefade').fadeOut(5000);

});

http://jsfiddle.net/BdHmG/7/

这篇关于如何使用jQuery在加载时缓慢淡出图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆