В этой статье описывается метод JS для достижения всплывающего оперативного эффекта после имитации оценки форума Zhongguancun. Поделитесь этим для вашей ссылки. Конкретный метод реализации следующим образом:
Скопируйте код следующим образом: <! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<голова>
<Title> JS Imation Effect Zongguancun Teffect Prop-Upper после рейтинга </title>
</head>
<тело>
<script language = "javascript">
var x = window.x || {};
x.creat = function (t, b, c, d) {
this.t = t;
this.b = b;
this.c = c;
this.d = d;
this.op = 1;
this.div = document.createElement ("div");
this.div.style.height = "40px";
this.div.style.width = "100px";
this.div.style.background = "red";
this.div.style.position = "Absolute";
this.div.style.left = "50%";
this.div.style.marginleft = "-50px"
this.div.style.margintop = "-20px"
this.div.innertext = "Спасибо за участие! Опыт +5"
this.div.style.fontsize = "12"
this.div.style.lineheight = this.div.style.height
this.div.style.textalign = "center";
this.div.style.fontweight = "Bold";
//this.div.style.border="solid red 1px ";
this.div.style.color = "#fff"
this.div.style.top = (this.b+"%");
document.body.appendchild (this.div);
this.run ();
}
x.creat.prototype = {
run: function () {
var me = это;
this.div.style.top = -this.c*(this.t/this.d)*(this.t/this.d)+this.b+"%";
this.t ++;
this.q = settimeout (function () {me.run ()}, 25)
if (this.t == this.d) {
ClearTimeout (me.q);
setTimeout (function () {me.alpha ();}, 1000);
}
},
alpha: function () {
var me = это;
if ("/v" == "v") {
this.div.style.filter = "progid: dximagetransform.microsoft.alpha (opacity ="+this.op*100+")";
this.div.style.filter = "alpha (opacity ="+this.op*100+")";
;}
else {this.div.style.opacity = this.op}
this.op- = 0,02;
this.w = settimeout (function () {me.alpha ()}, 25)
if (this.op <= 0) {
ClearTimeOut (this.W);
document.body.removechild (me.div);
}
}
}
новый X.Creat (1,50,25,30);
</script>
</body>
</html>
Я надеюсь, что эта статья будет полезна для каждого программирования JavaScript.