I use Parallax.js but that not working correctly. I have used this library several times but this time <div />
expands style="background-image: ......"
automatically X( Probably, other script prevented it.
<div class="parallax" data-parallax="scroll" data-image-src="./assets/img/top.jpeg" data-speed="0.6" data-position="center top">
</div>
currently:
<div class="parallax" data-parallax="scroll" data-image-src="./assets/img/top.jpeg" data-speed="0.6" data-position="center top" style="background: url("./assets/img/top.jpeg") center top / cover;">
</div>
should be:
<div class="parallax" data-parallax="scroll" data-image-src="./assets/img/top.jpeg" data-speed="0.6" data-position="center top">
</div>
You can delete the style
property once the DOM is loaded.
document.addEventListener('DOMContentLoaded', () => { const div = document.querySelector('.parallax'); div.removeAttribute('style'); });
<div class="parallax" data-parallax="scroll" data-image-src="./assets/img/top.jpeg" data-speed="0.6" data-position="center top"> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.