[英]After countdown redirect to new page
<!DOCTYPE html>
<!-- Html -->
<html lang="en">
<!-- Head -->
<head>
<title>Coming soon</title>
<!-- Meta tags -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Meta tags -->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" /><!-- stylesheet -->
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script><!-- Supportive-JavaScript -->
<!--fonts-->
<link href="//fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&subset=latin-ext" rel="stylesheet">
<!--/fonts-->
</head>
<!-- //Head -->
<!-- Body -->
<body>
<!-- main-section -->
<div class="container clock">
<div class="content">
<div id="large-header" class="large-header">
<canvas id="myCanvas"></canvas>
<div class="main-title">
<h1>Temperature Sensor <br /> coming soon</h1>
<div class="between"></div>
<p class="agileinfo txt-center"> © Janneke 2018</p>
</div>
</div>
</div>
</div>
<!-- /main-section -->
<!-- Counter required files -->
<link rel='stylesheet' href='css/dscountdown.css' type='text/css' media='all' />
<script type="text/javascript" src="js/dscountdown.min.js"></script>
<script src="js/clock.js"></script>
<script>
jQuery(document).ready(function($){
$('.between').dsCountDown({
endDate: new Date("Januari 17, 2018 17:30:00"),
theme: 'black'
});
});
</script>
<!-- //Counter required files -->
<!-- particles effect -->
<script src="js/particles.min.js"></script>
<script>
window.onload = function() {
Particles.init({
selector: '#myCanvas',
color: '#6a446b',
connectParticles: true,
minDistance: 70
});
};
</script>
<!-- //particles effect -->
</body>
<!-- //Body -->
</html>
<!-- //Html -->
我如何才能在此代碼中獲得重定向,甚至使用setTimeout從互聯網嘗試了很多解決方案,但是在添加setTimeout時,該頁面將僅顯示文本“溫度傳感器”即將推出,但不再顯示時間和日期,該頁面有粒子效果,但我需要知道如何在倒數計時部分獲得重定向。
可以gel住我的人都可以將其重定向到新頁面
一段關於我如何做的代碼,希望對您有所幫助。
window.setTimeout(function(){
// Move to a new location or you can do something else
window.location.href = "https://www.google.co.in";
}, 5000);
很簡單,您可以使用dsCountdown插件的onFinish選項。
$('.between').dsCountDown({
endDate: new Date("Januari 17, 2018 17:30:00"),
theme: 'black',
onFinish: function() {
window.location.assign('http://your-page.it');
}
});
我在dsCountdown庫中的以下位置找到了此選項( onFinish
): https : //github.com/iwayanwirka/dscountdown/blob/master/dscountdown.js
據我所知,您正在努力在倒數計時結束時重定向頁面嗎?
您已經錯過了倒計時腳本中的onFinish
屬性方法。 它是這樣的:
onFinish: function(){
window.location = "https://www.google.com";
}
我已經根據您的代碼在此處設置了一個示例應用程序,該應用程序在1分鍾后重定向到了Google: https : //jsfiddle.net/fatgamer85/a6dhjs2y/1/
希望這可以幫助?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.