gpt4 book ai didi

javascript - DOM 加载时背​​景轻微缩放?

转载 作者:行者123 更新时间:2023-12-02 17:22:11 24 4
gpt4 key购买 nike

如何在该网站上重现效果:

https://shop.stripe.com/

我的意思是等待 DOM 完全加载后再显示任何内容,然后让背景图像缩小 1 秒。非常酷。

最佳答案

它是通过一起使用不同的过渡和变换来完成的。演示:http://jsfiddle.net/lotusgodkk/eHAuh/2/

关键是在 document.ready 中添加/删除类

HTML:

<div id="DIV_1" class="scaled"></div>

JS:

$(document).ready(function () {
$('#DIV_1').attr('class', 'animatable');
setTimeout(function () {
$('#DIV_1').removeClass('animatable');
}, 1000)
});

CSS:

#DIV_1 {
background-position: 50% 50%;
bottom: 0px;
height: 472px;
left: 0px;
position: absolute;
right: 0px;
top: 0px;
width: 600px;
z-index: 1;
background: rgba(0, 0, 0, 0) url(https://shop.stripe.com/assets/images/showcase/thairu-kat.jpg) no-repeat scroll 50% 50% / cover padding-box border-box;
font: normal normal normal 16px/normal Helvetica, Arial, sans-serif;
zoom:1.1;
background-size:cover;
}
/*#DIV_1*/
.animatable {
-webkit-transition:all 750ms ease-out;
transition:all 750ms ease-out;
}
.scaled {
-webkit-transform:scale(1.02);
transform:scale(1.02);
}

关于javascript - DOM 加载时背​​景轻微缩放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23844649/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com