最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Animate div opacity on page load jQuery - Stack Overflow

programmeradmin0浏览0评论

I have a jQuery slideshow where when a thumbnail is hovered over the picture changes and a description of the picture shows up in the larger version of the picture. All of that works fine. I would like, however, to change the opacity of the div that contains the description of the picture (because it's overlaid on top of the larger picture).

I don't know why the below code isn't working.

<script type="text/javascript">
$(document).ready(function () {

$('#description').animate({opacity: 0.25},1000});
});

</script>

The selector is correct. Thanks for any help

I have a jQuery slideshow where when a thumbnail is hovered over the picture changes and a description of the picture shows up in the larger version of the picture. All of that works fine. I would like, however, to change the opacity of the div that contains the description of the picture (because it's overlaid on top of the larger picture).

I don't know why the below code isn't working.

<script type="text/javascript">
$(document).ready(function () {

$('#description').animate({opacity: 0.25},1000});
});

</script>

The selector is correct. Thanks for any help

Share Improve this question asked Apr 28, 2011 at 16:02 dzilladzilla 8325 gold badges14 silver badges22 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Maybe use fadeTo?

$('#description').fadeTo(1000, 0.25);

DEMO

try this:

$(document).ready(function () {

    $('#description').animate({opacity: 0.25},1000);
     //the error is in that } after the 1000 that you have

});

fiddle: http://jsfiddle/maniator/QfjNb/

发布评论

评论列表(0)

  1. 暂无评论