divの背景を固定して、divの切り替えが電話画面のように画像を切り替える効果を与えるようにしたい。それはこのバージョンの悪化のようです:https://www.android.com/versions/nougat-7-0/div内の固定位置のバックグラウンド画像
フィドルlink。
私はこのようにしようとしています:
.main {
min-height: 1000px;
}
.col1 {
width: 29.9%;
min-height: 800px;
display: inline-block;
float: left;
}
.col2 {
width: 70%;
min-height: 800px;
display: inline-block;
}
.row1 .col1 {
background: rgba(238, 238, 34, 0.3) url("https://icons.iconarchive.com/icons/graphicloads/100-flat-2/256/24-hours-phone-icon.png") !important;
background-position: left !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-attachment: fixed !important;
}
.row2 .col1 {
background: rgba(238, 238, 34, 0.3) url("https://icons.iconarchive.com/icons/graphicloads/100-flat-2/256/abs-icon.png") !important;
background-position: left !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-attachment: fixed !important;
}
.row3 .col1 {
background: rgba(238, 238, 34, 0.3) url("https://icons.iconarchive.com/icons/graphicloads/100-flat-2/256/arrow-down-icon.png") !important;
background-position: left !important;
background-repeat: no-repeat !important;
background-size: contain !important;
background-attachment: fixed !important;
}
<div class="main">
<div class="row1">
<div class="col1">
Col1
</div>
<div class="col2">
Col2
</div>
</div>
<div class="row2">
<div class="col1">
Col1
</div>
<div class="col2">
Col2
</div>
</div>
<div class="row3">
<div class="col1">
Col1
</div>
<div class="col2">
Col2
</div>
</div>
</div>
をしかし、絵はいつも私が必要とdivの内側のdivよりも大きいとせず、さらに多くの問題がときということですので、運がありませんブラウザのサイズが変化して、背景の位置も変化しています。
バックグラウンドの添付ファイルが固定されていることがわかっていますので、これは穴のビューポートであり、divではありませんが、これを実現するための回避策はありますか?
目標はこのマザーdiv内の固定位置ですが、スクロールすると切り替え効果が得られます。ブラウザのビューポートピクチャを変更すると、マザーdivの中央で常に同じサイズになります。
私はスクロール魔法について知っている、しかし、私はちょうどより多くの何か「自然な」トラフCSSやJSかもしれない最小のコードをしたいです。
はい、JSコードは完全ではない、単なる概念の証明:) – xDan