为什么自定义页面雪花代码飘在中间(网页飘雪花代码)
admin 发布:2022-12-19 15:32 135
今天给各位分享为什么自定义页面雪花代码飘在中间的知识,其中也会对网页飘雪花代码进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
- 1、网页飘雪花的代码是什么
- 2、手机某些网页打开会出现雪花和泡泡飘落是怎么回事?
- 3、CSS主页面中怎么加雪花飘落效果代码
- 4、淘宝雪花代码直接插自定义里会出现很长的空白区域
- 5、淘宝里首页飘雪花 怎么弄啊 js代码放在哪里啊 本人小白 希望大神详解.....
网页飘雪花的代码是什么
在后台添加js特效可实现这样的效果。
js代码为:
script language="JavaScript"
!--
var no = 5; //雪片数目
var speed = 20; //飘动速度。(值越大越慢)
var ns4up = (document.layers) ? 1 : 0; //当前浏览器类型,如果是NS则为1
var ie4up = (document.all) ? 1 : 0; //当前浏览器类型,如果是IE则为1
var s, x, y, sn, cs;
var a, r, cx, cy;
var i, doc_width = 800, doc_height = 600;
x = new Array();
y = new Array();
r = new Array();
cx = new Array();
cy = new Array();
s = 8; //每次下落的高度,越小越平滑,但是也越慢
if (ns4up) { //以NS兼容方式
doc_width = self.innerWidth; //取页面宽度
doc_height = self.innerHeight; //取页面高度
}
else
if (ie4up) { //以IE兼容方式
doc_width = document.body.clientWidth; //取页面宽度
doc_height = document.body.clientHeight; //取页面高度
}
for (i = 0; i no; ++ i) { //根据前面定义的雪片数目写进相应数目的层
initSnow(); //随机初始化层的坐标
if (ns4up) { //如果浏览器是NS
//用layer作为雪片(星号)的容器
document.write("layer name=\"dot"+ i +"\" left=\"1\" ");
document.write("top=\"1\" visibility=\"show\"font color=\"red\"");
document.write("*/font/layer");
}
else
if (ie4up) { //如果浏览器是IE
//用div作为雪片的容器
document.write("div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"font color=\"red\"");
document.write("*/font/div");
}
}
//初始化雪片,生成随机坐标
function initSnow() {
a = 6;
r[i] = 1;
sn = Math.sin(a);
cs = Math.cos(a);
cx[i] = Math.random() * doc_width + 1;
cy[i] = Math.random() * doc_height + 1;
x[i] = r[i] * sn + cx[i];
y[i] = cy[i];
}
//计算雪花位置,从新位置上出现,看起来就像是新产生的一样。
function makeSnow() {
r[i] = 1;
cx[i] = Math.random() * doc_width + 1;
cy[i] = 1;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
//雪花下落的计算
function updateSnow() {
r[i] += s;
x[i] = r[i] * sn + cx[i];
y[i] = r[i] * cs + cy[i];
}
//在NS浏览器上处理雪片下落的主程序
function SnowdropNS() {
for (i = 0; i no; ++ i) { //依次处理每片雪花
updateSnow(); //下落
if ((x[i] = 1) || (x[i] = (doc_width - 20)) || (y[i] = (doc_height - 20))) { //如果超出屏幕范围
makeSnow(); //则调整雪片到新位置上
doc_width = self.innerWidth; //更新页面宽度数据
doc_height = self.innerHeight; //更新页面高度数据
}
document.layers["dot"+i].top = y[i]; //改变层的Y坐标,应用新的位置
document.layers["dot"+i].left = x[i]; //改变层的X坐标,应用新的位置
}
setTimeout("SnowdropNS()", speed);
}
//在IE浏览器上处理雪片下落的主程序
function SnowdropIE() {
for (i = 0; i no; ++ i) { //依次处理每片雪花
updateSnow(); //下落
if ((x[i] = 1) || (x[i] = (doc_width - 20)) || (y[i] = (doc_height - 20))) { //如果超出屏幕范围
makeSnow(); //则调整雪片到新位置上
doc_width = document.body.clientWidth; //更新页面宽度数据
doc_height = document.body.clientHeight; //更新页面高度数据
}
document.all["dot"+i].style.pixelTop = y[i]; //改变层的坐标,应用新的位置
document.all["dot"+i].style.pixelLeft = x[i];
}
setTimeout("SnowdropIE()", speed); //准备下一次下落过程。
}
if (ns4up) { //如果是NS
SnowdropNS(); //调用SnowdropNS使雪片下落
}
else
if (ie4up) { //如果是NS
SnowdropIE(); //调用SnowdropIE使雪片下落
}
--
/script
说明:可以根据自己的需求根据说明进行相应参数的修改
手机某些网页打开会出现雪花和泡泡飘落是怎么回事?
手机某些网页打开会出现雪花和泡泡飘落是因为为了衬托圣诞节日气氛,很多网站开启了特效页面,在网页上做了特效代码,当打开网页的时候,特效就会显示出来。
CSS主页面中怎么加雪花飘落效果代码
html
head
title网页特效|Linkweb.cn/Js|---页面漫天飞雪/title
meta http-equiv="Content-Type" content="text/html; charset=gb2312"
/head
body bgcolor="#000000" onLoad="snow()"
script language="JavaScript"
!--
N = 40;
Y = new Array();
X = new Array();
S = new Array();
A = new Array();
B = new Array();
M = new Array();
V = (document.layers)?1:0;
iH=(document.layers)?window.innerHeight:window.document.body.clientHeight;
iW=(document.layers)?window.innerWidth:window.document.body.clientWidth;
for (i=0; i N; i++){
Y[i]=Math.round(Math.random()*iH);
X[i]=Math.round(Math.random()*iW);
S[i]=Math.round(Math.random()*5+2);
A[i]=0;
B[i]=Math.random()*0.1+0.1;
M[i]=Math.round(Math.random()*1+1);
}
if (V){
for (i = 0; i N; i++)
{document.write("LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,"+M[i]+","+M[i]+"'/LAYER")}
}
else{
document.write('div style="position:absolute;top:0px;left:0px"');
document.write('div style="position:relative"');
for (i = 0; i N; i++)
{document.write('div id="si" style="position:absolute;top:0;left:0;width:'+M[i]+';height:'+M[i]+';background:#fffff0;font-size:'+M[i]+'"/div')}
document.write('/div/div');
}
function snow(){
var H=(document.layers)?window.innerHeight:window.document.body.clientHeight;
var W=(document.layers)?window.innerWidth:window.document.body.clientWidth;
var T=(document.layers)?window.pageYOffset:document.body.scrollTop;
var L=(document.layers)?window.pageXOffset:document.body.scrollLeft;
for (i=0; i N; i++){
sy=S[i]*Math.sin(90*Math.PI/180);
sx=S[i]*Math.cos(A[i]);
Y[i]+=sy;
X[i]+=sx;
if (Y[i] H){
Y[i]=-10;
X[i]=Math.round(Math.random()*W);
M[i]=Math.round(Math.random()*1+1);
S[i]=Math.round(Math.random()*5+2);
}
if (V){document.layers['sn'+i].left=X[i];document.layers['sn'+i].top=Y[i]+T}
else{si[i].style.pixelLeft=X[i];si[i].style.pixelTop=Y[i]+T}
A[i]+=B[i];
}
setTimeout('snow()',10);
}
//--
/script
script language="Javascript"
!--
function selectAll(theField){
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
}
//--
/script
/table
/body
淘宝雪花代码直接插自定义里会出现很长的空白区域
那个好像是设计师才可以写的吧,看没到代码不敢断言。希望采纳
淘宝里首页飘雪花 怎么弄啊 js代码放在哪里啊 本人小白 希望大神详解.....
div class="J_TWidget" data-widget-config="{'duration':0.1,'activeTriggerCls':'.tshop-psm-shop-ww-hover','interval':0.1,'effect':'scrollx','activeIndex':1,'navCls':'user-crzysj','contentCls':'user-crzysjii','autoplay':true}" data-widget-type="Carousel" style="position:relative;"ul class="user-crzysjii" style="display: none; width: 999999px; left: 0px; position: absolute;"li class="-_-switchable-panel-internal535 ks-switchable-panel-internal998" style="width: 475px; height: 800px; display: block; float: left;" /li/ulul class="user-crzysj"li class="-_-switchable-trigger-internal534 ks-switchable-trigger-internal997 tshop-psm-shop-ww-hover" style="width:475px;height:800px;right:50%;margin-right:505px;"embed allownetworking="all" allowscriptaccess="never" flashvars="scene=taobao_shop" height="1000" name="flashfirebug_1387778983714" src="" type="application/x-shockwave-flash" width="475" wmode="transparent"/li/ul/divdiv class="J_TWidget" data-widget-config="{'duration':0.1,'activeTriggerCls':'.tshop-psm-shop-ww-hover','interval':0.1,'effect':'scrollx','activeIndex':1,'navCls':'user-crzysj','contentCls':'user-crzysjii','autoplay':true}" data-widget-type="Carousel" style="position:relative;z-index:99;"ul class="user-crzysjii" style="display: none; width: 999999px; left: 0px; position: absolute;"li class="-_-switchable-panel-internal635 ks-switchable-panel-internal1108" style="width: 475px; height: 800px; display: block; float: left;" /li/ulul class="user-crzysj"li class="-_-switchable-trigger-internal634 ks-switchable-trigger-internal1107 tshop-psm-shop-ww-hover" style="width:475px;height:800px;left:50%;margin-left:505px;"embed allownetworking="all" allowscriptaccess="never" flashvars="scene=taobao_shop" height="1000" name="flashfirebug_1387778983652" src="" type="application/x-shockwave-flash" width="475" wmode="transparent"/li/ul/div
直接在首页添加个自定义模块 编辑 点两个箭头的那个编辑代码模式 然后复制代码放进去 确定就好!
关于为什么自定义页面雪花代码飘在中间和网页飘雪花代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
- 上一篇:7z源代码(7z源代码Linux编译)
- 下一篇:3d动漫代码(3D动画动漫)
相关推荐
- 05-18免费网页设计制作网站,免费网页设计软件
- 05-18制作网页一般多少钱,网页制作要多少钱
- 05-17长沙网站制作公司哪家好,长沙网页制作公司
- 05-17免费建网页,怎样免费建立网站
- 05-17做公司网页,做公司网页有什么简单的方法
- 05-17百度网页推广,百度网页推广费用
- 05-16百度知道网页版地址,百度知道的网址
- 05-15北京网站建设制作公司,北京网站制作网页
- 05-15如何制作一个网页网站,如何制作一个网页?
- 05-13怎么制作公司网页,怎样制作自己公司的网页
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接