■ 公式サイト
fakeLoader.jshttp://joaopereirawd.github.io/fakeLoader.js/
デモサイト
http://joaopereirawd.github.io/fakeLoader.js/demo/demo1.htmlライセンス
https://github.com/joaopereirawd/fakeLoader.js/blob/master/LICENSE* MIT (商用利用可能)
■ サンプル
<!doctype html>
<html lang="jp">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="">https://cdnjs.cloudflare.com/ajax/libs/fakeLoader.js/1.1.0/fakeLoader.css">
<title>Hello, world!</title>
</head>
<body>
<button id="helloworld">Click Me!</button>
<div id="fakeLoader"></div>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="
crossorigin="anonymous"></script>
<script src="">https://cdnjs.cloudflare.com/ajax/libs/fakeLoader.js/1.1.0/fakeLoader.js">
<script type="text/javascript">
$(window).on('load', function(){
$('#helloworld').on('click',function(){
$('#fakeLoader').fakeLoader({
timeToHide: 1200,
bgColor: "#9b59b6",
spinner: "spinner7"
});
});
});
</script>
</body>
</html>
■ 注意
* jQuery3では、エラーとなり、「timeToHide」が全く効かなくなった => Bootstrap4 で使おうとしたのだが... * 以下のサイトでも同じ現象?https://teratail.com/questions/77675
現象が発生しているサンプル
動くは動くのだが、「timeToHide」が全く効かない<!doctype html>
<html lang="jp">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Font Awesome v5.2 -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<link rel="stylesheet" href="">https://cdnjs.cloudflare.com/ajax/libs/fakeLoader.js/1.1.0/fakeLoader.css">
<title>Hello, world!</title>
</head>
<body>
<button id="helloworld" class="btn">Click Me!</button>
<div id="fakeLoader"></div>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="">https://cdnjs.cloudflare.com/ajax/libs/fakeLoader.js/1.1.0/fakeLoader.js">
<script type="text/javascript">
$(function(){
$('#helloworld').on('click',function(){
$('#fakeLoader').fakeLoader({
timeToHide: 1200,
bgColor: "#9b59b6",
spinner: "spinner7"
});
});
});
</script>
</body>
</html>
エラー内容
VM46 fakeLoader.js:120 Uncaught TypeError: $(...).load is not a function
at VM46 fakeLoader.js:120
at VM46 fakeLoader.js:128
~~~~~~~
L120 $(window).load(function(){
~~~~~~~
fakeLoader.js:90 Uncaught TypeError: $(...).fadeOut is not a function
at fakeLoader.js:90
エラーの原因は、jQuery3を使用しているため? https://wemo.tech/109