用JS实现购物网站商品放大镜效果

(编辑:jimmy 日期: 2024/9/21 浏览:2)

放大镜效果就是把鼠标移到图片上的时候,旁边会有另外一张大的图片展示,放大镜效果,那这样的效果怎样实现的呢,我把代码发给大家,请大家参考。

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>放大镜</title>
 <style>
 *{margin:0;padding: 0;}
 #warp{width: 1184px;height:500px;margin:50px auto 0;background-color: #ccc;overflow: hidden;padding: 10px;position: relative;}
 #warp #minbox{width: 350px;height: 350px;float: left;position: relative;}
 #maxbox{width: 400px;height: 400px;position: absolute;left: 380px;overflow: hidden;display: none;}
 #maxbox img{width: 800px;height: 800px;position: absolute;}
 #con{float: left;margin-left: 20px;}
 #meng{width: 175px;height: 175px;position: absolute;background-color:yellow;opacity:0.4;filter:alpha(opacity=40);left: 0;top: 0;display: none;}
 </style>
</head>
<body>
 <div id="warp">
 <div id="minbox">
  <img src="/UploadFiles/2021-04-02/min.jpg">

效果如下:

用JS实现购物网站商品放大镜效果希望本文所述对大家javascript程序设计有所帮助。

一句话新闻
微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。