jQuery 淡入淡出效果以转移到另一个页面
jQuery fadein effect to transfer to another page
我正在尝试设置加载页面,并在移动到索引.html页面之前将超时设置为 5 秒。我想通过一些基本的过渡淡入淡出转移到此页面,我想知道我该怎么做?
我目前的代码是:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> Go Post - HomePage </title>
<link rel="stylesheet" href="includes/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
setTimeout(function(){
window.location='index.html';
}, 3000);
</script>
</head>
<body>
<div class="load"></div>
</body>
</html>
你可以简单地通过jquery fadeOut来做到这一点。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title> Go Post - HomePage </title>
<link rel="stylesheet" href="includes/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Import jquery -->
<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script>
setTimeout(function(){
$('html').fadeOut(
500, // animation time
function(){
// action will do after the animation
window.location='index.html';
}
);
}, 3000);
</script>
</head>
<body>
<div class="load"></div>
</body>
</html>
试试下面
在 HTML 中添加div
<div id="preloader">
</div>
jQuery
$(function() {
setTimeout(function() {
$('#preloader').fadeOut('slow', function() {
window.location = "https://google.com";
});
}, 5000);
});
.CSS:
div#preloader {
background: url("http://www.mytreedb.com/uploads/mytreedb/loader/ajax_loader_blue_512.gif") no-repeat scroll center center #000000;
height: 100%;
position: fixed;
width: 100%;
z-index: 999;
}
演示 : http://codepen.io/anon/pen/gPqLPX
相关文章:
- 如何将值从区域转移到另一个区域
- 从一个功能到另一个功能的呼叫转移
- jQuery 淡入淡出效果以转移到另一个页面
- 如何动态生成将对象转移到另一个Node进程的代码
- 如何使用javascript将值从一个页面转移到另一个页面
- 将所选行转移到另一个表
- 使用java脚本将值从一个页面转移到另一个页面
- 在javascript中将点击事件从一个页面转移到另一个页面
- 如何获得memberID从一个页面转移到另一个,javascript
- 如何通过Javascript将php会话从一个页面转移到另一个页面
- 我可以在Javascript中将一个变量的值转移到另一个变量吗?
- 如何有选择地将一个函数中的所有画布动作转移到另一个函数
- 如何使用jquery将表行转移到另一个表中
- 在转移到另一个功能之前,我如何完全完成一个功能
- 在单击表单时,转移到另一个PHP页面,并显示复选框的结果
- 我如何从以前的JS状态保存“this”并将其转移到另一个
- 在RHEL5中,Firefox无法将焦点转移到另一个文本输入
- 无法在Firefox中将单击事件从一个元素转移到另一个元素
- PHP变量从一个页面转移到另一个页面
- 如何使用jquery将列表框值转移到另一个列表框