当前位置:网站首页>Understand preloading and lazy loading, and learn slow animation
Understand preloading and lazy loading, and learn slow animation
2022-07-26 03:09:00 【M78_ Domestic 007】
Preloading : There will be many links when loading the page 、 Pictures, etc , Load resources ahead of time -- Optimization of homologous loading .
Lazy loading : Resources are not loaded first Wait until the conditions are satisfied , If our web page slips to a certain position, it will start loading .
Now just know it first .
Slow motion animation
Changing the style of elements at a constant speed is uniform animation ; Changing the style of elements at a non-uniform speed is slow animation .
It's very simple to realize slow motion animation , Just remember a formula :
The set value = Current value +( The target - Current value )* percentage
Use with timer , Add less and less each time , Realize jogging .
Small example :
Slide in slowly at the bottom
<style>
.box{
margin: 100px auto;
width: 300px;
position: relative;
height: 450px;
overflow: hidden;
}
img{
width: 300px;
}
.info{
position: absolute;
top: 450px;
height:150px;
width: 100%;
background-color: rgba(255,255,255,0.8);
display: flex;
flex-direction: column;
justify-content: space-around
}
.info div{
height: 40px;
color: gray;
text-align: center;
}
.info div span{
color: orange;
margin-left:20px ;
}
</style>
<div class="box">
<img src="../img/ star 7.jpg" alt="">
<div class="info">
<div> Gulinaza <span> Annual salary :***<span></div>
<div> actor Dancer Boy killer </div>
<div> induction *** Co., LTD. </div>
</div>
</div>
<script>
var info=document.querySelector(".info")
var box=document.querySelector(".box")
var timer1=null
var timer2=null
box.onmouseenter=function(){
clearInterval(timer2)
timer1 = setInterval(function(){
var nowcsstop=parseInt(window.getComputedStyle(info).top)
// console.log(nowcsstop);
info.style.top=nowcsstop +(300-nowcsstop)*0.5+"px"
},100)
}
box.onmouseleave=function(){
clearInterval(timer1)
timer2 = setInterval(function(){
info.style.top=parseInt(info.style.top)+(450-parseInt(info.style.top))*0.5+"px"
},100)
}
</script>边栏推荐
- Neo4j import CSV data error: neo4j load CSV error: couldn't load the external resource
- [NOIP2001 普及组] 最大公约数和最小公倍数问题
- LeetCode·每日一题·919.完全二叉树插入器·层次遍历·BFS
- STM32 - DMA notes
- Teach you to rely on management hand in hand
- YOLOv3: An Incremental Improvement
- Unity快速搭建城市场景
- STM - exti external interrupt learning notes
- 【无标题】
- 【C语言】深入理解 整型提升 和 算术转换
猜你喜欢

小测(一)

Summary of Huawei virtualization fusioncompute knowledge points

Remember SQL optimization once

Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)

Win11大小写提示图标怎么关闭?Win11大小写提示图标的关闭方法
![[untitled]](/img/6f/a2cd98af7a8de469e5311422b48afe.png)
[untitled]

软件测试岗:阿里三面,幸好做足了准备,已拿offer

实现一个方法,找出数组中的第k大和第m大的数字相加之和

c语言分层理解(c语言函数)

多线程编程
随机推荐
GoLang日志编程系统
经典面试问题——OOP语言的三大特征
[noip2001 popularization group] the problem of maximum common divisor and minimum common multiple
【C进阶】深入探索数据的存储(深度剖析+典例解读)
The source of everything, the choice of code branching strategy
Usage of arguments.callee
Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)
[C Advanced] deeply explore the storage of data (in-depth analysis + interpretation of typical examples)
Safety margin of mass consumption
Get twice the result with half the effort: learn the web performance test case design model
ENVI_ Idl: create HDF5 file and write data (take writing GeoTIFF file to HDF file as an example) + detailed parsing
复制列表时踩过的坑:浅拷贝与深拷贝
How to correctly calculate the CPU utilization of kubernetes container
canvas——心电图的设计,以及如何清理画布
Usage of fuser and lsof
VR panoramic shooting and production of business center helps businesses effectively attract people
这种动态规划你见过吗——状态机动态规划之股票问题(上)
Qt 信号在多层次对象间传递 多层嵌套类对象之间信号传递
[sql] usage of self connection
STM32——DMA笔记