現在パララックスサイトを制作しておりますが、スマートフォンで確認すると背景画像がスクロールした時にヘッダーとフッターが縮小することにより、背景に敷いている画像が拡大してしまいます。
こちらを解消したいのですが、なかなかcssで解消できずに困っております。
こちらはcss3で直せるのかJSで直せるのかわかる方いらっしゃいましたらご教授いただけませんでしょうか。
ご協力のほど何卒よろしくお願い致します。
パララックスデモサイト
URL削除しました。ご協力ありがとうございました!
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>parallax demo</title> <meta name="viewport" content="width=device-width,initial-scale=1"> <style> html,body { width: 100%; height: 100%; } body { margin: 0; padding: 0; } img { width: 100%; height: auto; } p { margin: 0; padding: 0; line-height: 1.5; } /* ============================================================== */ /* ======================== 824px以下 =========================== */ /* ============================================================ */ @media screen and (max-width:824px) { #slider { width: 100vw; height: 100%; background-image: url(../images/mainvisual-01.jpg); background-position: top center; background-repeat: no-repeat; background-size: cover; position: fixed; top: 0; z-index: 0; } .content { position: absolute; top: 100%; height: 1000px; background-color: #ccc; } /* ================================================= */ /* =================== SP END. ==================== */ /* =============================================== */ } /* ============================================================== */ /* ======================== 825px以上 =========================== */ /* ============================================================ */ @media screen and (min-width:825px) { #slider { width: 100vw; height: 100%; background-image: url(../images/mainvisual-01.jpg); background-position: center; background-repeat: no-repeat; background-size: cover; background-attachment: fixed; } .content { height: 1000px; background-color: #ccc; } /* ================================================= */ /* =================== PC END. ==================== */ /* =============================================== */ } </style> </head> <body> <div id="slider"> </div> <!-- /#slider --> <div class="content"> <p>テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキスト</p> </div> <!-- /.content --> </body> </html>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。