2

我试过搜索,但找不到明确的答案,有谁知道 Stackoverflow 使用什么来通过淡入橙色突出显示对页面的更改?

它只是 jquery 淡入淡出还是某种脉动效果?

因此,例如,我有一个页面,当用户在各个位置单击时,我会更改一些元素,我想通过像 StackOverflow 那样使它们脉动来引起对这些页面更新的注意。

假设它是jquery,只是不确定哪个效果。

谢谢。

4

2 回答 2

2

稍微查看一下源代码后,找到了执行“脉冲”的确切代码:

// if you have firebug, run this in the console, it will first hide all
$("#notify-container div").hide();
$("body").css('marginTop','0px');
// this actually show the pulse
$("#notify-container div").fadeIn("slow");
$("body").animate({
    marginTop: "2.5em"
}, "fast", "linear");

您需要更好的逆向工程技能,尤其是当您拥有源代码时。

请注意,body 动画有几个变量可以确保 marginTop 具有正确的大小。这个确切的代码用于新用户,发出通知:

欢迎来到专业和狂热程序员的问答环节——查看常见问题解答!

于 2011-04-09T09:55:02.630 回答
0

使用 jquery 你可以这样做:

<input type="button" value="TEST" id="button"/>
<div id="fade" style="display:none">This is test</div>

$('#button').click(function(){
    $('#fade').fadeIn(5000,function(){
        $('#fade').fadeOut(5000);
    }); 
});
于 2011-04-09T09:51:37.643 回答