html特效(html源码下载)
大家好,如果您还对html特效不太了解,没有关系,今天就由本站为大家分享html特效的知识,包括html源码下载的问题都会给大家分析到,还望可以解决大家的问题,下面我们就开始吧!
怎么给html5背景加上js粒子特效
使用了particles.js
particles.js可以从github网站下载到最新的源码,网址是
使用方法非常简单
第一步,在html中引入脚本文件 particles.min.js,这个文件在下载的压缩包里可以找到
<scriptsrc="particles.min.js"></script>第二步,在html中放入一个div容器,设置id为particles-js。这个一般放在所有网页元素的最后面就可以。
<divid="particles-js"></div>
<styletype="text/css">
#particles-js{
position:absolute;
top:0;
width:100%;
}
</style>第三步,设置窗口样式
<styletype="text/css">
#particles-js{
z-index:-1;
position:absolute;
top:0;
width:100%;
background:#aaa;
}</style>第四步,脚本生成粒子效果,可以单独放在一个js文件里,也可以放在<script>标签里。无论如何,这段脚本要出现在div容器之后。
particlesJS("particles-js",{"particles":{"number":{"value":380,"density":{"enable":true,"value_area":800
}
},"color":{"value":"#ffffff"
},"shape":{"type":"circle","stroke":{"width":0,"color":"#000000"
},"polygon":{"nb_sides":5
},"image":{"src":"img/github.svg","width":100,"height":100
}
},"opacity":{"value":0.5,"random":false,"anim":{"enable":false,"speed":1,"opacity_min":0.1,"sync":false
}
},"size":{"value":3,"random":true,"anim":{"enable":false,"speed":40,"size_min":0.1,"sync":false
}
},"line_linked":{"enable":true,"distance":150,"color":"#ffffff","opacity":0.4,"width":1
},"move":{"enable":true,"speed":6,"direction":"none","random":false,"straight":false,"out_mode":"out","bounce":false,"attract":{"enable":false,"rotateX":600,"rotateY":1200
}
}
},"interactivity":{"detect_on":"canvas","events":{"onhover":{"enable":true,"mode":"grab"
},"onclick":{"enable":true,"mode":"push"
},"resize":true
},"modes":{"grab":{"distance":140,"line_linked":{"opacity":1
}
},"bubble":{"distance":400,"size":40,"duration":2,"opacity":8,"speed":3
},"repulse":{"distance":200,"duration":0.4
},"push":{"particles_nb":4
},"remove":{"particles_nb":2
}
}
},"retina_detect":true});
求一个网页特效的代码
给你两种代码,自己选择。第一种要等全部文字消失后才开始下一轮的滚动,第二种是无缝滚动,也就是还没等最后一句消失,下一次滚动已经开始。新闻链接的滚动大部分都是采取第二种。代码中出现的#号表示链接地址。其余参数自行调整。
<MARQUEE onmouseover=this.stop() onmouseout=this.start() style="LEFT: 0px; POSITION: absolute; line-height:20px;TOP=100px;" scrollAmount=2 direction=up height=120 width=200><font color=#B0D8DC size=2><center><a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">你在做什么</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">我在仰望天空</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">30度仰望是什么</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">是我想念她的角度</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">为什么要把头抬到30度</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">为了不让我的眼泪掉下来</a><br></MARQUEE>
二、文字向上无缝滚动
<div id=marquees style="height=100px;LEFT: 60px; POSITION: absolute; TOP: 100px;"><font style="font-family:宋体; color:white; font-size:14px;line-height=15px">
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">你在做什么</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">我在仰望天空</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">30度仰望是什么</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">是我想念她的角度</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">为什么要把头抬到30度</a><br>
<br>
<a rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="#">为了不让我的眼泪掉下来</a><br>
<br>
<br>
<br>
</div>
<script language="JavaScript">
marqueesHeight=100;
stopscroll=false;
with(marquees){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');
preTop=0; currentTop=0;
function init(){
templayer.innerHTML="";
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval("scrollup()",30);
}
document.body.onload=init;
function scrollup(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}
}
</script>
网页特效代码
在HTML文件中添加网页特效代码,一般有三种情况。
第一,只加在HTML文件头部,即HTML文件中<head>……</head>之间的代码。这类代码只需要加在这个部分,即可达到预期的效果。
第二,只加在HTML文件体部。即HTML文件中<body>……</body>之间的代码。这类代码只需要加在这个部分,即可达到预期的效果。如在你题目中提到的就属于这一类。
除上述情况外,多数代码需要先在头部(<head>……</head>之间)在上一些属性性质的代码,但是特效的主代码需要添加在体部(body>……</body>之间),否则,特效不能正常显示,有时还会出现错误,影响整个页面的正常显示。
添加特效代码的方法:
先要用HTML编辑软件,如常见的文本编辑器“记事本”,打开需要编辑的文件,根据特效代码的要求,在文件中找到相应位置,复制,粘贴特效代码,保存即可。修改完毕后,即可在浏览器中看到相应的效果。
在添加的时候一定要注意,一定要按照特效源码的要求添加,此外,还要保证源码的完整性,一个标点符号都不能少,也不能多。
另外要说的是,根据我的经验,直接从网上复制来的代码,不一定都能直接粘贴了用,一部分必须通过一个软件来中转。比如,先把网上的代码复制后,粘贴到“记事本”中,然后再复制、粘贴到相应的文件位置上。
最后,介绍你几个经典网页特效站。
1、网页特效集锦:
2、javascript网页特效:
3、万旭网页特效:
4、网页特效梦工厂:
5、网页制作大宝库网页特效大全:
html特效和html源码下载的问题分享结束啦,以上的文章解决了您的问题吗?欢迎您下次再来哦!