css+js实现鼠标跟随页面放大镜效果代码

代码语言:html

所属分类:其他

代码描述:css+js实现鼠标跟随页面放大镜效果代码

代码标签: css js 鼠标 跟随 页面 放大镜

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: none;
  overflow-x: hidden;
}

.page-content {
  position: relative;
  z-index: 1;
  padding: 2rem;
}

.grid-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 2px, transparent 2px), radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 80px 80px, 40px 40px;
  -webkit-animation: gridMove 20s linear infinite;
          animation: gridMove 20s linear infinite;
  z-index: 0;
}

.floating-elements {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.floating-element {
  position: absolute;
  border-radius: 50%;
  -webkit-animation: float 8s ease-in-out infinite;
          animation: float 8s ease-in-out infinite;
}

.floating-element:nth-child(1) {
  width: 120px;
  height: 120px;
  top: 10%;
  left: 5%;
  background: rgba(255, 107, 107, 0.15);
  -webkit-animation-delay: 0s;
          animation-delay: 0s;
}

.floating-element:nth-child(2) {
  width: 80px;
  height: 80px;
  top: 70%;
  right: 10%;
  background: rgba(78, 205, 196, 0.15);
  -webkit-animation-delay: 2s;
          animation-delay: 2s;
}

.floating-element:nth-child(3) {
  width: 100px;
  height: 100px;
  bottom: 20%;
  left: 70%;
  background: rgba(69, 183, 209, 0.15);
  -webkit-animation-delay: 4s;
          animation-delay: 4s;
}

.text-content {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 3rem;
}

.main-title {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(45deg, #fff, #e0e0e0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.effect-label {
  font-size: 1.2rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1rem;
  letter-spac.........完整代码请登录后点击上方下载按钮下载查看

网友评论0