1

嗨,我正在尝试重新创建类似 SO 上的效果,您单击评论,页面加载,并且给定的评论背景淡出。

到目前为止我有

    var theHash = window.location.hash;
    $(theHash).hover(function() {
    $(this).stop().animate({ backgroundColor: "#a7bf51"}, 800);
    },function() {
    $(this).stop().animate({ backgroundColor: "#ffffff" }, 800);
    });

在悬停时效果很好,但我希望在页面准备好时自动完成。

是否有此事件,而不是使用“悬停”?谢谢

4

2 回答 2

2

认为我把事情复杂化了,这对我来说很好 -

$(document).ready(function(){
    var theHash = window.location.hash;
    theHash=theHash.substr(1);  
    $("#f"+theHash).css('backgroundColor',"#E47527");
    $("#f"+theHash).animate({backgroundColor: "#ffefe3" }, 2000);
});

无论如何谢谢 !

于 2010-10-08T09:25:46.123 回答
0

这是你要找的吗?

$(document).ready(function(){
....
});
于 2010-09-30T15:32:30.843 回答