js+css实现鼠标悬停文本菜单多个产品图片跟随效果代码
代码语言:html
所属分类:悬停
代码描述:js+css实现鼠标悬停文本菜单多个产品图片跟随效果代码,可通过tweakpane修改参数。
代码标签: js css 鼠标 悬停 文本 菜单 多个 产品 图片跟 随效
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
/* @import 'normalize.css' layer(normalize); */
@import url('https://unpkg.com/normalize.css') layer(normalize);
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');
@layer normalize, base, demo, positioning, anchoring, boxes, tweaks, images, debug;
@layer debug {
[data-debug='true'] {
img {
--opacity: 0.2;
}
.holder {
outline: 0.1em dashed hsl(10 100% 50% / 0.2);
outline-offset: 0.1em;
}
.box {
outline: dashed red 0.1em;
}
.holding {
outline: hsl(10 100% 50% / 0.5) dashed 0.1em;
outline-offset: 0.1em;
}
.scope {
outline: red dashed 0.1em;
outline-offset: 0em;
}
}
}
@layer images {
.box img {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
border-radius: 0.2em;
grid-area: 1 / 1;
opacity: 0;
transition: opacity 0.25s 0s;
mix-blend-mode: plus-lighter;
box-shadow: 0px 0.2px 0.2px var(--shadow-color),
0.1px 1.4px 1.6px -0.4px var(--shadow-color),
0.1px 2.7px 3px -0.7px var(--shadow-color),
0.2px 4.4px 5px -1.1px var(--shadow-color),
0.3px 7px 7.9px -1.4px var(--shadow-color),
0.4px 10.9px 12.3px -1.8px var(--shadow-color),
0.6px 16.6px 18.7px -2.1px var(--shadow-color),
0.9px 24.4px 27.5px -2.5px var(--shadow-color);
}
.box {
display: grid;
isolation: isolate;
}
.container:has(li:nth-of-type(1):hover) .box img:nth-of-type(1),
.container:has(li:nth-of-type(2):hover) .box img:nth-of-type(2),
.container:has(li:nth-of-type(3):hover) .box img:nth-of-type(3),
.container:has(li:nth-of-type(4):hover) .box img:nth-of-type(4),
.container:has(li:nth-of-type(5):hover) .box img:nth-of-type(5) {
opacity: var(--opacity, 1);
z-index: 2;
transition-delay: 0s;
}
}
@layer tweaks {
:root {
--elastic-out: linear(
0 0%,
0.6832 7.89%,
0.9171 11.07%,
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0