青梅竹马,从小一起长到大 突然有一天,他对她说:“嫁给我吧” 但是她犹豫不决 于是他们用剪刀石头布决定一切 他赢了 结婚后她问他,为什么那么有把握。 他淡淡地一笑: “七岁的时候我就知道你喜欢出石头”
//随机颜色的方法
function randomColor(){
return parseInt(Math.random()*255+1);
}
//获取窗口的宽高
var width=$(Window).width();
var height=$(Window).height();
$("#div").css({
'height':height ,
'width':width
})
//代码部分手写效果
var value_dm=$("#heartText4").text();
var count_dm=0;
var timer_dm=setInterval(function(){
count_dm++;
$("#heartText3").text(value_dm.substring
(0,count_dm));
var l1=parseInt($("#heartText3").
text().length);
var l2=parseInt(value_dm.length);
if(l1==l2){
clearInterval(timer_dm);
clearInterval(timer_container);
$("#heartText3").remove();
}
},4)
//代码所在的容器循环上移
var timer_container=setInterval(function(){
var t1=$("#heartText3").css("top").
replace("px","");
$("#heartText3").css("top",
(parseInt(t1)-500)+"px");
},6000)
//文字部分的手写效果
var value=$("#heartText").text();
var count=0;
var timer=setInterval(function(){
count++;
$("#heartText2").text(value.
substring(0,count));
$("#heartText2").css({
"color":"rgb("+randomColor()+","
+randomColor()+","+randomColor()+")",
"fontSize":'30px',
'fontFamily':'楷体'
})
if(count>value.length){
clearInterval(timer)
}
},50)
//满天红心的随机漂浮的效果
setInterval(function(){
var tem="❤
";
$("#div").append(tem);
$("p").css({
"z-index": 9999,
'position':'absolute',
'top':Math.random()*(height-160)+120,
'left':Math.random()*(width-160)+40,
'color':"red",
'fontSize':parseInt(Math.random()
*20+20)+'px'
})
var p_tem=$("p").css("fontSize").
replace("px","");
$("p").animate({
'top':parseInt($("p").css("top"))-10,
'left':parseInt($("p").css("left"))+10,
'opacity':0,
'fontSize':(parseInt(p_tem)+
(Math.random()*10+20))+'px'
},3500,function(){
$(this).empty()
})
},300)