当前位置:网站首页>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>边栏推荐
- Usage of fuser and lsof
- [noip2001 popularization group] the problem of maximum common divisor and minimum common multiple
- Detailed explanation of extended physics informedneural networks paper
- canvas——绘制文本——饼图的修改
- Win11大小写提示图标怎么关闭?Win11大小写提示图标的关闭方法
- canvas——绘制曲线——挂钟,饼图,五角星
- [translation] announce Vites 13
- snownlp库各功能及用法
- How about GF Securities? Is it safe to open an account online?
- Standardize your own debug process
猜你喜欢

File operation (I) -- File introduction and file opening and closing methods

FPGA_Vivado软件初次使用流程_超详细

MySQL tutorial: MySQL database learning classic (from getting started to mastering)
![[translation] cloud like internal load balancer for kubernetes?](/img/e5/f003ebed05a94d2936cfef5617f745.jpg)
[translation] cloud like internal load balancer for kubernetes?

Digital commerce cloud DMS dealer management system solution: DMS system realizes business Omni channel and sales data collection
![[detailed explanation of key and difficult points of document operation]](/img/f5/99c8cdf09763c66ab5d56cc96e50c7.png)
[detailed explanation of key and difficult points of document operation]

Difference between soft link and hard link

Study notes of pytorch deep learning practice: convolutional neural network (Advanced)

canvas——绘制文本——饼图的修改

My friend took 25koffer as soon as he learned automation test. When will my function test end?
随机推荐
Unity quickly builds urban scenes
[NOIP2001 普及组] 最大公约数和最小公倍数问题
【C进阶】深入探索数据的存储(深度剖析+典例解读)
How to reinstall win7 system?
STM32——DMA笔记
STM32 - DMA notes
Quick check of OGC WebGIS common service standards (wms/wmts/tms/wfs)
26 points that must be paid attention to for stability test
一篇文章让你理解 云原生 容器化相关
[noip2001 popularization group] the problem of maximum common divisor and minimum common multiple
Qt 信号在多层次对象间传递 多层嵌套类对象之间信号传递
GoLang日志编程系统
canvas——矩形的绘制——柱状图的制作
The difference between the world wide web, the Internet and the Internet
当点击Play以后,EditorWindow中的变量会被莫名其妙销毁.
Nahamcon CTF 2022 babyrev reverse analysis
Longest Substring Without Repeating Characters
Win11大小写提示图标怎么关闭?Win11大小写提示图标的关闭方法
Anti electronic ink screen st7302
【C语言】深入理解 整型提升 和 算术转换