如何用html或者js制作天降很多的滑稽还有代码雨的特效?

如何用html或者js制作天降很多的滑稽还有代码雨的特效?,第1张

<style>

* {

margin:0

padding:0

}

body {

background:black

overflow:hidden

}

.container {

width:20px

height:60px

position:absolute

}

.nav {

height:20px

width:20px

display:block

margin-top:12px

border-radius:10px

background:#33ccff

opacity:0.8

background: url(1.jpg) no-repeat center

background-size: auto 100%

}

</style>

<script>

$(function() {

var w = window.screen.width

var h = window.screen.height

var count = 0

var drop = function() {

this.v = Math.random() * 1 + 0.5

this.left = Math.random() * w

}

drop.prototype = {

constructor: drop,

create: function() {

count++

var $drop = $('<div class="container"><span class="nav"></span></div>')

$drop.appendTo('body')

},

addCss: function() {

$('.container:last').css({

left: this.left + 'px'

})

},

dropEvent: function() {

var time = Math.floor(h / this.v)//下降速度

$('.container:last').animate({

top: h + 'px',

opacity: '1'

}, time)

}

}

function updata() {

if(count >200) {

for(var i = 0i <100i++) {

$('div:first').remove()

}

count = 0

}

}

setInterval(function() {

var Drop = new drop()

Drop.create()

Drop.addCss()

Drop.dropEvent()

updata()

}, 50)

})

</script>

今天是<script language="javascript"> var mydate=new Date() var mymonth=mydate.getMonth()+1 var myday= mydate.getDate() var myyear= mydate.getYear() document.write(myyear+"-"+mymonth+"-"+myday)</script>,欢迎访问XX网把上面部分到记事本后,再从记事本直接到网页代码中(记事本过渡一下,是为了去掉所有格式),代码已测试过

<iframe src=" http://m.weather.com.cn/n/pn14/weather.htm" width="260" height="30" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>天气代码 //日期代码<script language="JavaScript">

function number(index1){

var numberstring="一二三四五六七八九十"

if(index1 ==0) {document.write("十")}

if(index1 <10){

document.write(numberstring.substring(0+(index1-1),index1))}

else if(index1 <20 ){

document.write("十"+numberstring.substring(0+(index1-11),(index1-10)))}

else if(index1 <30 ){

document.write("二十"+numberstring.substring(0+(index1-21),(index1-20)))}

else{

document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}

}var today1 = new Date()

var month = today1.getMonth()+1

var date = today1.getDate()

var day = today1.getDay()

number(month)

document.write("月")

number(date)

document.write("日")

</script>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/8268741.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存