[英]how can i add background image parallax scroll effect using tailwind css?
這是我正在處理的代碼示例。 我需要為背景圖像添加視差滾動效果。 我試過 background-attachment: fixed,但這只是一個固定的背景。 我想像通常的視差一樣添加一些變換或縮放效果。
<body>
<nav>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</nav>
<div class="bg-image"><!-- this div have background-image set and needs to be parallax -->
<div class="content"> <!-- This is the normal content that needs to be over background image -->
</div>
</div>
<div class="bg-image"><!-- this div have background-image set and needs to be parallax -->
<div class="content"> <!-- This is the normal content that needs to be over background image -->
</div>
</div></body>
<body>
<nav>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</nav>
<UPDATED>
<div class="flex items-center justify-center h-screen mb-12 bg-fixed bg-center bg-cover bg-image"><!-- this div have background-image set and needs to be parallax -->
</div>
<UPDATED content div>
<div class="content"> <!-- This is the normal content that needs to be over background image -->
</div>
<UPDATED>
<div class="flex items-center justify-center h-screen mb-12 bg-fixed bg-center bg-cover bg-image"><!-- this div have background-image set and needs to be parallax -->
</div>
<UPDATED content div>
<div class="content"> <!-- This is the normal content that needs to be over background image -->
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.