悬浮弹出图片跟随效果
代码语言:html
所属分类:悬停
代码描述:悬浮弹出图片跟随效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Montserrat&display=swap"rel="stylesheet'>
<link type="text/css" rel="stylesheet" href="http://repo.bfw.wiki/bfwrepo/css/locomotive-scroll.min.css">
<style>
@import url("https://fonts.googleapis.com/css2?family=Notable&display=swap");
:root {
--color-text: #e4e4e4;
--color-bg: #111111;
--cursor-stroke: #dddddd;
--cursor-fill: #e2e2e2;
--cursor-stroke-width: 2px;
}
*,
*::after,
*::before {
box-sizing: border-box;
}
:root {
font-size: 12px;
}
body {
margin: 0;
color: var(--color-text);
background-color: var(--color-bg);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow-x: hidden;
}
a {
text-decoration: none;
outline: none;
cursor: pointer;
}
a:hover,
a:focus {
outline: none;
}
.menu {
padding: 20vh 0 20vh 0;
width: 100vw;
position: relative;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
counter-reset: menucounter;
opacity: 0;
}
.menu__item {
display: flex;
flex-direction: column;
align-items: start;
position: relative;
padding-left: 25vw;
}
.menu__item::before {
counter-increment: menucounter;
content: counters(menucounter,".",decimal-leading-zero);
position: absolute;
top: -25%;
left: 18%;
transform: translateX(1rem);
height: 100%;
display: flex;
align-items: center;
font-weight: bold;
font-size: 8vw;
font-family: "Notable";
transition: transform 0.2s, opacity 0.08s;
color: var(--color-text);
opacity: 0;
pointer-events: none;
}
.menu__item:hover::before {
opacity: 0.2;
transform: translateX(0);
}
.menu__item:hover .menu__item-innertext {
color: var(--color-text);
}
.menu__item:hover .menu__item-sub {
opacity: 1;
transform: translateX(0);
}
.menu__item:hover .menu__item-sub .char {
transform: translate(0) rotate(0);
opacity: 1;
}
.menu__item-text {
position: relative;
cursor: pointer;
display: block;
overflow: hidden;
padding: 1vh 0;
font-size: 4vw;
}
.menu__item-innertext {
display: block;
font-family: "Notable", serif;
font-weight: 300;
text-transform: uppercase;
white-space: nowrap;
color: transparent;
-webkit-text-stroke: 2px var(--color-text);
transition: color 0.05s;
mix-blend-mode: screen;
transform: translateY(200%);
}
.menu__item-sub {
display: flex;
text-transform: uppercase;
font-weight: bold;
font-family: sans-serif;
white-space: nowrap;
position: relative;
overflow: hidden;
mix-blend-mode: difference;
}
.menu__item-sub .word:not(:first-child) {
margin-left: 0.5ch;
}
.menu__item-sub .char {
--char-delay: 6ms;
display: inline-block;
transform: translateY(-100%) rotate(-15deg);
opacity: 0;
transition: transform 0.25s ease-in-out, opacity 0.3s;
transition-delay: calc(0ms + var(--char-index) * var(--char-delay));
}
.image-card {
position: absolute;
z-index: -1;
width: 200px;
height: 300px;
top: 0;
left: 0;
pointer-events: none;
}
.image-card__inner,
.image-card__img {
width: 100%;
height: 100%;
position: relative;
}
.image-card__img {
background-size: cover;
background-position: 50% 50%;
opacity: 0;
}
.cursor {
display: none;
}
.credits {
font-family: sans-serif;
font-size: 0.9rem;
color: #fff;
position: fixed;
right: 20px;
top: 20px;
z-index: 20;
}
.credits a {
color: #6fe2ff;
}
@media screen and (max-width: 54em) {
.menu {
padding-top: 10rem;
}
.menu__item {
flex: none;
padding-left: 6rem;
}
.menu__item::before {
top: -5%;
left: 1%;
}
.menu__item-text {
padding: 0.5rem;
font-size: 6vw;
}
.menu__item-sub {
display: none;
}
}
@media (any-pointer: fine) {
.cursor {
position: fixed;
top: 0;
left: 0;
display: block;
pointer-events: none;
}
.cursor.cursor__small circle {
fill: var(--cursor-fill);
opacity: 0.5;
}
.cursor.cursor__large circle {
fill: none;
stroke: var(--cursor-stroke);
stroke-width: var(--cursor-stroke-width);
opacity: 0.5;
}
}
.loading__wrapper {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #000;
z-index: 200;
}
.loading__wrapper .loader--text {
color: #fff;
font-family: "Montserrat";
font-weight: 500;
margin-bottom: 1.4rem;
}
.noisy__bg {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: -1;
}
.noisy__bg::before {
content: "";
position: fixed;
opacity: 0.015;
width: 300%;
height: 300%;
left: -110%;
top: -110%;
animation: grain 8s steps(10) infinite;
background: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAEAAQADASIAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAAAgMEBQEA/8QAMRAAAgICAQQCAgIBBAMAAgMAAQIDEQQSIQUTIjEAFDJBI1FCFSRSYTNicUOBJTTC/8QAGAEAAwEBAAAAAAAAAAAAAAAAAQIDAAT/xAAuEQABAwEGBAcBAQEBAQAAAAABAAIRIQMSMUFR8GFxgZEiobHB0eHxEzIjM0L/2gAMAwEAAhEDEQA/AEprNjtLLnQtNGgR7XUIoCOwV46Y2jhbIo1+iVtkJTI6RAJ5MdjmKrX2+20jB0YCUknkCwOLI2qtuCxIp48XBEEkbxhZSy+EJn2qhGgFagh7a+fIlhan5JkY8cGHkwvMpj1CwsWikHK00SNSjl1N0B6r3yzBt3wmNlIyyMBkwfLP3V+PrEsUj/b/AIRAscjh5VBsqSrKaX8x6CuCeACSvyTCjmylMX2RiQbM7jGa3Cqos6kqKNuWJFMVJFi/ju25lVsRYcdJf5WYyqD3QwtmCgiy1UTwaqxv8SwGUUyM5caEY8B7jFjJEuQ1oQAb8fEgV6Ab3WwVpB/9K+yq+rZiK741QY4jgrLjlny0nISVZ4SzrMrGiS5U2SQGI/YJsHUGnNjixHhyeoAwdNk7nliAnUAFlYFQym1LCgw4JJ9HU8UfbzxA8uYCrNPbL2zfmApfhV9gBaAJX0Lv4WD9OQQD7aojKkLt3xJ9iREdCqDWy3kDYokcAAMAQXw0kY+fsudwDX3S2vf6So8VsHpTKTI5lDAF28YyWWVblZACVoH+/wAbUakgzlzmL6pnxfsyqoiZJlLqQYyD+XP5MBsSVUBjey2BXquRBimZRNBkxBJ0jYRs6MRqpOw3FMaF803kFIPyaTNSNzPhPNI+UqrAIlDI6hULv5WdifEIKYHWybJ+MYZE1dwV2Am0EniJHFWxRQJGZIpPrSMxgaL7Gix7rzVAqV4F8AjQAgX4yQdjMxsWU4EeGpmliZ4pRCQ5UUgct5Kar0Kogizt8cJcqDNyO0shkClViyix/BvAjVQaFvTEGiysAOSnExp+oZjpjzRx4kYUTFEGkShWoBlIDNUjm9eav+id4g43jTeXVH/pJl0Rh55o4s3LaL/T+6nYWJXTIxZS0si60xPJ/FWFKRfIH68kY2GcrFWJpoI5Qe9IjErL2oiRGVXeiHaxQYV3G/IgN8T.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0