jQueryで、サイトの読み込み時に全画面でフェードインする様なページを作成したのですが、フェードダウンが終わった際、ページの先頭が表示されるのではなく、途中から表示されるのですが、何か対策することはできるのでしょうか?
パソコンでのこの問題は発見していませんが、新規にスマートフォンで読み込んだ際に起こります。
しかし、ページを更新すると、正常に表示されます。
html
1<!DOCTYPE html> 2<html lang="ja"> 3<!-- headは省略させていただきます。 --> 4<body> 5 6 <h1>見出し<h1> 7 <h3>サブタイトル</h3> 8 <h3><strong>21-22</strong></h3> 9 10 <!-- <iframe width="100%" height="215" src="https://www.youtube.com/embed/v9Ah7AvQ-W0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> --> 11 12 </center> 13 <br><h2 class="title01">サブタイトル</h2> 14 <P>ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。/P> 15 <br><h2 class="title01">サブタイトル</h2> 16 <p>ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。</p> 17 <br><h2 class="title01">サブタイトル</h2> 18 <p>ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。</p> 19 <br><h2 class="title01">このサイトについて</h2> 20 <p>ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。ここに紹介文が入ります。 21 <footer class="bottom"><p>©Programming</p></footer> 22 23 <div class="start"><p style="margin-bottom: 1em;"><img src="slice_13.png" alt="ロゴ画像" class="img_logo"></p></div> 24 25 26 27<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> 28<script> 29 $(function() { 30 setTimeout(function(){ 31 $('.start p').fadeIn(1900); 32 },990); //0.5秒後にロゴをフェードイン! 33 setTimeout(function(){ 34 $('.start').fadeOut(500); 35 },3500); //2.5秒後にロゴ含め真っ白背景をフェードアウト! 36 }); 37</script> 38<!--css--> 39<style type="text/css"> 40 body { 41 margin-top: 50px; 42 margin-left: 0px; 43 margin-right: 0px; 44 } 45 46 .img_logo{ 47 max-width: 100%; 48 height: 0 auto; 49 width: 0 auto; 50 text-align: center; 51 } 52 53 .body { 54 margin-top: 50px; 55 margin-left: 0px; 56 margin-right: 0px; 57 } 58 59 .btn { 60 background: #3f3f3f; 61 padding: 20px; 62 font-size: 14px; 63 } 64 65 .btn1 { 66 text-decoration: none; 67 padding: 5px; 68 color: white; 69 } 70 71 .bottom { 72 text-align: center; 73 color: gray; 74 } 75 76 .start { 77 background: #FFF; 78 position: fixed; 79 top: 0; 80 left: 0; 81 height: 100%; 82 width: 100%; 83 z-index: 9000; 84 } 85 86 .start p { 87 position: fixed; 88 left: 50%; 89 top: 50%; 90 transform: translate(-50%, -50%); 91 display: none; 92 z-index: 9999; 93 width: 280px; 94 } 95 96 h2 { 97 padding: 0.4em 0.5em;/*文字の上下 左右の余白*/ 98 color: #494949;/*文字色*/ 99 background: #f4f4f4;/*背景色*/ 100 border-left: solid 5px #7db4e6;/*左線*/ 101 border-bottom: solid 3px #d7d7d7;/*下線*/ 102 } 103 104</style> 105</body> 106</html>
回答1件
あなたの回答
tips
プレビュー