js页面载入特效如何实现
js页面载入特效如何实现
一、总结
一句话总结:可以加选择器(里面的字符串)作为参数,这样函数就可以针对不同选择器,就很棒了。
1、特效的原理是什么?
都是通过标签的位置和样式来实现特效的。
二、js页面载入特效如何实现
/*
* 1、每种特效分为快中慢(l,m,s)
* 2、弄一个随机特效函数random,通过数组实现,也分为快中慢(l,m,s),通过时间参数来实现
* */
/******************************1、通用函数******************************/
var speed=new Array();
speed['l']=200;
speed['m']=500;
speed['s']=800;
//alert('11');
//随机特效函数
function randomp(width,height,time) { }
//
/******************************2、页面平滑载入函数(slide)******************************/
/*
* 1、左上右下
* left top right bottom
* 2、斜的
* leftTop topRight rightBottom bottomLeft
* */ var slideArr=new Array(
'slideLeft',
'slideTop',
'slideRight',
'slideBottom',
'slideLeftTop',
'slideTopRight',
'slideRightBottom',
'slideBottomLeft'
); function slideRandom_l(width,height,time=speed.l) {
slideRandom(width,height,time)
// var length=slideArr.length;
// var index=Math.floor(Math.random()*length);
// var functionName=slideArr[index];
// //alert(functionName);
// //alert(functionName+'('+width+','+height+','+time+')')
// eval(functionName+'('+width+','+height+','+time+')'); }
function slideRandom_m(width,height,time=speed.m) {
slideRandom(width,height,time)
}
function slideRandom_s(width,height,time=speed.s) {
slideRandom(width,height,time)
} function slideRandom(width,height,time) {
var length=slideArr.length;
var index=Math.floor(Math.random()*length);
var functionName=slideArr[index];
//alert(functionName);
//eval(functionName+'(width,height,time)');
//alert(functionName+'('+width+','+height+','+time+')')
eval(functionName+'('+width+','+height+','+time+')'); } function slideLeft(width,height,time) {
$('body').animate({
'left': '-'+width,
opacity: '0'
}, 0,'linear');
$('body').animate({
'left': '0',
opacity: '1'
}, time,'linear');
}
function slideTop(width,height,time) {
$('body').animate({
'top': '-'+height,
opacity: '0'
}, 0,'linear');
$('body').animate({
'top': '0',
opacity: '1'
}, time,'linear');
}
function slideRight(width,height,time) {
$('body').animate({
'left': '+'+width,
opacity: '0'
}, 0,'linear');
$('body').animate({
'left': '0',
opacity: '1'
}, time,'linear');
}
function slideBottom(width,height,time) {
$('body').animate({
'top': '+'+height,
opacity: '0'
}, 0,'linear');
$('body').animate({
'top': '0',
opacity: '1'
}, time,'linear');
}
function slideLeftTop(width,height,time) {
$('body').animate({
'left': '-'+width,
'top': '-'+height,
opacity: '0'
}, 0,'linear');
$('body').animate({
'left': '0',
'top': '0',
opacity: '1'
}, time,'linear');
}
function slideTopRight(width,height,time) {
$('body').animate({
'left': '+'+width,
'top': '-'+height,
opacity: '0'
}, 0,'linear');
$('body').animate({
'left': '0',
'top': '0',
opacity: '1'
}, time,'linear');
}
function slideRightBottom(width,height,time) {
$('body').animate({
'left': '+'+width,
'top': '+'+height,
opacity: '0'
}, 0,'linear');
$('body').animate({
'left': '0',
'top': '0',
opacity: '1'
}, time,'linear');
}
function slideBottomLeft(width,height,time) {
$('body').animate({
'left': '-'+width,
'top': '+'+height,
opacity: '0'
}, 0,'linear');
$('body').animate({
'left': '0',
'top': '0',
opacity: '1'
}, time,'linear');
} /******************************3、什么样式(slide)******************************/
js页面载入特效如何实现的更多相关文章
- 页面优化——js异步载入
同步载入 在介绍js异步载入之前.我们先来看看什么是js同步载入.我们平时最常使用的就是这样的同步载入形式: <script src="http://XXX.com/script.js ...
- 如何提高ASP.NET页面载入速度的方法
前言 本文是我对ASP.NET页面载入速度提高的一些做法,这些做法分为以下部分: 1.采用 HTTP Module 控制页面的生命周期. 2.自定义Response.Filter得到输出流stream ...
- HTML 页面载入 Flash 插件的几种方法
前言 之所以写这篇文章,主要是由于组长给提的一个新的需求--使用浏览器调用电脑的摄像头,来实现即时拍照的功能.在网上查了非常多资料,由于这样那样的原因,终于选择了使用flash插件来调用pc的摄像头. ...
- js页面加载完后执行(document.onreadystatechange 和 document.readyState)
js页面加载完后执行javascript(document.onreadystatechange 和 document.readyState) document.onreadystatechange ...
- 提高ASP.NET页面载入速度的方法
前言 本文是我对ASP.NET页面载入速度提高的一些做法,这些做法分为以下部分: 目录 1.采用 HTTP Module 控制页面的生命周期. 2.自定义Response.Filter得到输出流str ...
- jQuery--事件, 事件绑定, 阻止事件冒泡, 事件委托,页面载入后函数
1.常用事件, 按住shift键实现同步选择效果,搜索框联想效果 2.阻止事件冒泡 3.事件委托 4.使用 $(document).ready(function (){...}) 实现文件加载完绑定事 ...
- 新手遇到的问题:Easy UI的对话框老是在页面载入完毕后自己主动弹出
因为是第一次接触Easy UI,还不是非常熟悉,尝试了一下对话框功能,还是非常不错的.但问题是页面载入完毕后.全部的对话框都自己主动弹出来了,百度了好久,也没有详细说明确的,貌似别人都没有这个问题哦 ...
- jQuery的页面载入
jQuery 页面载入 $(document).ready(function(){ //程序段 }) 原生javaScript window.onload = function(){ //程序段 } ...
- js页面跳转整理
js页面跳转整理 js方式的页面跳转1.window.location.href方式 <script language="javascript" type=" ...
随机推荐
- 【习题 8-13 UVA - 10570】Meeting with Aliens
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 枚举1的位置在i 往右摆成一排. a[i+1]..a[n]..a[1]..a[i-1]变为有序的 ->寻找循环节,每个循环节的 ...
- wmic linux python
sudo aptitude install wmi-client Example of usage is; wmic -U DOMAIN/administrator%password //10.99. ...
- Finance and Good Society
Finance is a technology of great power. It plays an important role in our society which range from t ...
- HBase-scan API 通过scan读取表中数据
直接贴代码啦 /** * * @param zkIp * @param zkPort * @param tablename * @param startRow 传null扫全表 * @param st ...
- mysql 不能启动的两种错误提示及解决方法
在linux系统中安装mysql服务器详细步骤并解决ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using passw ...
- launcher- 第三方应用图标替换
有时候我们感觉第三方应用的icon不美观,或者跟我们主题风格不一致,这时候我们希望换成我们想要的icon,那我们可以这么做(以更换QQ应用icon为例): 1.首先我们当然要根据自己的需要做一张替换i ...
- Android学习笔记之详细讲解画圆角图片
package xiaosi.RoundConcer; import android.app.Activity; import android.graphics.Bitmap; import andr ...
- HDU 4631 Sad Love Story 平面内最近点对
http://acm.hdu.edu.cn/showproblem.php?pid=4631 题意: 在平面内依次加点,求每次加点后最近点对距离平方的和 因为是找平面最近点对...所以加点以后这个最短 ...
- cocos2d-x认识之旅
cocos2d-x 学习历程 1. 了解cocos2d-x.官网 : www.cocos2d-x.org 2. 搭建cocos2d-x. 使用版本号cocos2d-x 3.0 搭建好开发环境教程:ht ...
- .less为后缀的文件是什么
.less为后缀的文件是什么 一.总结 1.less是什么:LESS 为 Web 开发者带来了福音,它在 CSS 的语法基础之上,引入了变量,Mixin(混入),运算以及函数等功能,大大简化了 CSS ...