Looking for a jQuery effect to gradually reveal a hidden DIV/image

你。 提交于 2019-12-04 17:15:59

Put the hover image in a div that has this style class:

.blind {
    height: 0px;
    overflow: hidden;
}

That makes the image invisible because its container (the div) is zero-height and its overflow (the whole image) is hidden.

Then animate div.blind like so:

$('.blind').animate({height: "40px"});

Now the image's container is big enough for the whole hover image. The hover image is gradually revealed, from top to bottom.

I have this working at: http://jsfiddle.net/cHt8V/1/

To avoid these jquery animation method flickers I'd animate the height of a container of the "hover" look, like so:

http://jsfiddle.net/Lj7z9/16/

you can achieve this by using slideDown('slow') in jQuery for animation. You can control speed by using slow or fast or normal as parameter.

updated the fiddle : http://jsfiddle.net/Lj7z9/14/

There are only 2 ways I can think of to do this, and one is creating an animated image (which you don't want). The other way is inspired by youlove.us's old homepage (they used a white png with transparency, with the words "cut out" from the background. This was layered over a coloured background that constantly scrolled.)

You could adapt this by using 3 divs with absolute positioning and suitable z-index values to place them on top of one another: the bottom has a grey background the top is an image with the word "home" cut out so the grey shows through the middle is the one that you will animate... create a div with red background and animate it using toggle() (or slideup & slidedown if you prefer)

I hope this makes sense?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!