js+css实现图片网格切片位置打乱冒泡排序还原效果代码
代码语言:html
所属分类:其他
代码描述:js+css实现图片网格切片位置打乱冒泡排序还原效果代码,将图片切成25个小块,位置打乱,然后用冒泡排序算法进行还原的过程。
代码标签: js css 图片 网格 切片 位置 打乱 冒泡 排序 还原
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
img{
display: block;
}
body{
min-height: 100svh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1rem;
background-color: #000;
color: #FFF;
font-family: system-ui,sans-serif;
}
#container {
width: 400px;
height: 400px;
display: grid;
grid-template-columns: repeat(5, 1fr);
padding: 1rem;
border: 1px solid #FFFFFF50;
border-radius: 5px;
}
.box{
transition: 500ms ease-in-out;
}
button {
-webkit-appearance: none;
text-align: inherit;
background: none;
box-shadow: none;
cursor: pointer;
border: 1px solid #FFFFFF30;
color: inherit;
font: inherit;
outline: none;
background-color: #033e97;
padding: .5rem 1.25rem;
border-radius: 5px;
transition: background 300ms ease-in-out;
}
button:disabled {
opacity: 50%;
cursor: none;
}
button:hover,
button:focus-visible {
background-color: #4a0366;
}
</style>
</head>
<body translate="no">
<div id=&quo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0