プリローダーが読み込みを停止してメインページに移行したくない。 プリローダーは3-4秒間ロードしてからページに自動的に移行するはずです。私はjquery/javascriptのものを削除しようとしました。しかし、私はそれを修正するオプションを見つけることができませんでした。プリローダーが停止せず、メインページへの切り替えが発生しない
ウェブでも解決策を探しましたが、どれも私を助けませんでした。
ご協力いただきありがとうございます。
jQuery(document).ready(function($) {
// site preloader -- also uncomment the div in the header and the css style for #preloader
$(window).load(function() {
$('#preloader').fadeOut('slow', function() {
$(this).remove();
});
});
});
.js div#preloader {
position: fixed;
left: 0;
top: 0;
z-index: 999;
width: 100%;
height: 100%;
overflow: visible;
background: #333 url('http://files.mimoymima.com/images/loading.gif') no-repeat center center;
}
<?php
/**
* Maintenance mode template. This is shown to anyone that is logged out or not an administrator!
* @package maintenance-mode
* @copyright Copyright (c) 2016, ZartanLOL
* @license GPL2+
*/
?>
<!DOCTYPE html>
<html>
<head>
<meta charset ="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php echo plugins_url('assets/css/maintenance.css', dirname(__FILE__)); ?>">
<link rel="stylesheet" href="<?php echo plugins_url('assets/css/mobile.css', dirname(__FILE__)); ?>">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.2/modernizr.js"></script>
<script src="<?php echo plugins_url('assets/js/preload.js', dirname(__FILE__)); ?>"></script>
<title>Maintenance Mode</title>
</head>
<body>
<div id="preloader"></div>
<div class="maintenance-mobile">
<div class="maintenance-mobile-text">
<h1>Maintenance</h1>
<p>This website is currently undergoing scheduled maintenance. We will be back shortly! Sorry for the inconvenience.</p>
</div>
<div class="maintenance-container">
<a class="maintenance-login" href="<?php echo wp_login_url(); ?>">Go to Login Page</a>
</div>
</div>
<div class="maintenance-container">
<a class="maintenance-login" href="<?php echo wp_login_url(); ?>">Go to Login Page</a>
</div>
</body>
</html>
ありがとうございました。私はjqueryでかなり悪いです。だから。 - 時々、ページが読み込まれプリローダーが消えてプリローダーが回転し続けるという問題があります。プリローダーを常に3秒間ロードし、1時間または2時間に1回だけロードするには、何が必要ですか? – BPrepper
@BPrepperこれはおそらくキャッシングと関係があります。あなたは、キャッシュが '$(window).on(" load ")関数を起動するとは限りません。実際には非常に悪い習慣です。試してみて、これを行う方法を見つけましょう。しかし、はい、あなたはちょうど安定した3秒のプリローダーを行うことができます(これは非常に長いですが、 'setTimeout()'関数を使って1.5秒以上かかることはお勧めしません)。 'setTimeout()'の詳細についてはこれを見てください:http://www.w3schools.com/jsref/met_win_settimeout.asp – NoobishPro
ああ、ヘッダーの代わりにフッタにJavaScriptを入れてみることをお勧めしますか?数百のウェブサイトを構築した後、特に** Google Chrome **がヘッダーに含まれているときにJavaScriptのトリガー時間を浪費する傾向があることに気付きました。 (ヘッダーにjQueryを入れておきますが、フッタ内の/