js+css实现图片放大镜效果代码

代码语言:html

所属分类:图片放大

代码描述:js+css实现图片放大镜效果代码

代码标签: js css 图片 放大镜

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

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

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        * {
            padding: 0;
            margin: 0
        }
        
        body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: rgba(202,202,202,0.5)
        }
        
        .container {
            width: 300px;
            box-shadow: 0 0 20px rgba(0,0,0,.4);
            position: relative;
            overflow: hidden
        }
        
        .mirror {
            width: 240px;
            height: 240px;
            border-radius: 50%;
            overflow: hidden;
            position: absolute;
            border: 4px solid #fff;
            top: 0;
            left: 0;
            transform: translate(-10px,-10px);
            box-shadow: 0 0 40px rgba(0,0,0,.7)
        }
        
        .mirror img {
            position: absolute
        }
    </style>

</head>

<body>
    <div class="container">
        <img src="//repo.bfw.wiki/bfwrepo/image/62bd3df45f392.png" width="100%" alt="">
        <div class="mirror&.........完整代码请登录后点击上方下载按钮下载查看

网友评论0