当前位置:首页 > 日记 > 正文

jquery仿京东商品放大浏览页面

jquery仿京东商品放大浏览页面

jquery仿京东商品页面

京东页面大家都很熟悉,进入商品页面把鼠标放在图片上旁边会出现一个放大的效果,接下来就带大家看看怎么实现的!!!!

仿京东商品页面css的代码!!!

*{  margin: 0;  padding: 0;}.da{  width: 360px;  height: 418px;  float: left;}.shang{  width: 350px;  height: 350px;  border: 1px solid #ccc;  margin: 10px 0 10px 10px;  position: relative;}.yin{  width: 150px;  height: 150px;  border: 1px solid #ccc;  background: rgba(255,255,255,0.3);  position: absolute;  top:0;  left: 0;  cursor: pointer;  display: none;}.bao{  width: 362px;  height: 56px;}.tab{  width: 320px;  height: 56px;  margin-left: 10px;  overflow: hidden;}.Ul{  width: 9999px;  height: 56px;}.Ul li{  width: 52px;  height: 52px;  float: left;  border: 2px solid #ccc;  margin-left: 8px;  list-style: none;  position:relative;  text-align:center;}.li{  width: 52px;  height: 52px;  border: 2px solid #FF7403;}.li img{  display: block;  position: absolute;  top:50%;  left: 50%;  margin-top:-26px;  margin-left:-26px;}.zuo{  display: block;  width: 12px;  height: 56px;  background: url(../img/icon_clubs.webp) no-repeat;  background-size: 180px 608px;  background-position: -82px -462px;  float: left;  margin-left: 10px;}.you{  display: block;  width: 12px;  height: 56px;  background: url(../img/icon_clubs.webp) no-repeat;  background-size: 180px 608px;  background-position: -95px -462px;  float: right;  margin-top: -56px;}.xia{  width: 360px;  height: 418px;  border: 1px solid #ccc;  float: left;  margin: 10px 0 0px 20px;  overflow: hidden;  display: none;}.lie{  width: 1329px;  height: 30px;  margin-left: 10px;  margin-top: 20px;  border-bottom: 2px solid #BE0000;}.lie li{  float: left;  list-style: none;  width: 80px;  height: 28px;  background: #fff;  border-radius: 3px;  border: 0;  line-height: 30px;  text-align: center;  margin-right: 5px;  border:1px solid #BE0000;  color: #c30;  cursor: pointer;  font-weight: bold;}.lie>ul .ll{  width: 80px;  height: 30px;  background: #BE0000;  border-radius: 3px;  border: 0;  line-height: 30px;  text-align: center;  color: #fff;  cursor: pointer;}.nie{  width: 1329px;  height: 200px;  margin-left: 10px;  overflow: hidden;}.bao1{  width: 1329px;  height: 500px;}.up{  width: 1329px;  height: 200px; }.up span{  display: block;  padding:10px 0 0 10px;  margin-bottom: 70px;}.up p{  text-align: center;  margin-top: 5px;}.down{  width: 1329px;  height: 300px;   background: yellow;}

仿京东商品页面html的代码!!!

<div>  <div class="da ">  <div class="shang">    <img src="img/b1.webp" height="350" width="350" id="pian">    <div class="yin"></div>  </div>  <div class="bao">    <span class="zuo"></span>      <div class="tab">      <ul class="Ul">        <li>          <img src="img/b1.webp" height="52" width="52" />        </li>        <li>          <img src="img/b2.webp" height="52" width="52" />        </li>        <li>          <img src="img/b3.webp" height="52" width="52" />        </li>        <li>          <img src="img/b1.webp" height="52" width="52" />        </li>        <li>          <img src="img/b2.webp" height="52" width="52" />        </li>        <li>          <img src="img/b3.webp" height="52" width="52" />        </li>        <li>          <img src="img/b1.webp" height="52" width="52" />        </li>        <li>          <img src="img/b2.webp" height="52" width="52" />        </li>      </ul>    </div>      <span class="you"></span>    </div>    <div class="lie ">      <ul>        <li class="ll">图文介绍</li>        <li>评论(1)</li>      </ul>    </div>      <div class="nie">      <div class="bao1">        <div class="up">          <span>暂无好评!</span>          <p>适用浏览器:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗</p>          <p>来源:师徒课堂</p>        </div>        <div class="down">          <img src="img/11.webp" height="300" width="1329" />        </div>      </div>    </div>  </div>  <div class="xia">    <img src="img/b1.webp" height="600" width="600" id="zhao" />  </div></div>

仿京东商品页面jquery的代码!!!

$(function(){  var $yin = $(".yin");  $(".Ul li img").mouseover(function(){    $(this).parent().addClass("li").siblings().removeClass("li");    $("#pian").attr("src",$(this).attr("src"));    $("#zhao").attr("src",$(this).attr("src"));  }).mouseout(function(){    $(this).parent().removeClass("li");  });  var l = $(".shang").eq(0).offset().left;  var t = $(".shang").eq(0).offset().top;  var width1 = $(".yin").outerWidth()/2;  var height1 = $(".yin").outerHeight()/2;  var maxL = $(".shang").width() - $yin.outerWidth();  var maxT = $(".shang").height() - $yin.outerHeight();  var bili = $("#zhao").width()/$("#pian").width();  $(".shang").mousemove(function(e){    var maskL = e.clientX - l - width1,maskT = e.clientY - t - height1;    if (maskL < 0) { maskL = 0};    if (maskT < 0) { maskT = 0};    if (maskL > maxL) {maskL = maxL};    if (maskT > maxT) {maskT = maxT};    $yin.css({"left":maskL,"top":maskT});    $(".xia").show();    $(".yin").show();    $("#zhao").css({"margin-left":-maskL*bili,"margin-top":-maskT*bili});  });  $(".shang").mouseleave(function(){    $(".xia").hide();    $(".yin").hide();  });  var marginLeft = 0;  $(".you").click(function(){    marginLeft = marginLeft - 64;    if (marginLeft < -192) {marginLeft = -192};    $(".tab ul").stop().animate({"margin-left":marginLeft},"fast");  });  $(".zuo").click(function(){    marginLeft = marginLeft + 64;    if (marginLeft > 0) {marginLeft = 0};    $(".tab ul").stop().animate({"margin-left":marginLeft},"fast");  });  $(".lie li").click(function(){    var index=$(this).index();    $(this).addClass("ll").siblings().removeClass("ll");     $(".bao1>div").eq(index).show().siblings().hide();  });});

仿京东商品页面的效果!!!

怎么样,当我做出来的时候感觉神清气爽!!!!!

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

相关文章

PPT制作墙砖字的方法怎么做

PPT制作墙砖字的方法怎么做

方法,怎么做,电脑软件,PPT,  还在为你的PPT文字平凡不起眼而烦恼吗?Duang~墙砖字震撼来袭!墙砖的字体,看起来还是非常不错滴。以下是小编为您带来的关于PPT制作墙砖字,希望对您有所帮助。PPT制作墙砖字1、在&ldquo;设计&rdquo;选项卡中将幻…

Photoshop调制出昏暗的霞光色铁路

Photoshop调制出昏暗的霞光色铁路

调制,霞光,弯道,昏暗,铁路,素材图片有点杂乱,同时天空部分泛白;处理的重点是把天空换上霞光;然后在合适的位置渲染一些阳光;再把图片边角区域压暗,杂乱的区域涂暗即可。原图最终效果 1、打开原图素材大图,创建可选颜色调整图层,对红、黄、绿进行调…

jquery实现放大点击切换

jquery实现放大点击切换

电脑软件,jquery,本文实例为大家分享了jquery放大点击切换图片展示的具体代码,供大家参考,具体内容如下html代码<body><div class="boss"> <div class="bigimg"> <img src="img/s1.jpg" height="350" width="350" id="spic"> …

canvas的神奇用法

canvas的神奇用法

神奇,电脑软件,canvas,canvas有一个神奇的方法getImageData这个玩意。它可以获取canvas内图像的没一个像素点的颜色值获取,而且可以改变。如果你有各种滤镜的算法。那么用canvas就可以实现图片的滤镜转化,可以做成类似美图秀秀那样的功能。使…

ppt2010主题样式库的使用方法

ppt2010主题样式库的使用方法

使用方法,样式,主题,电脑软件,今天小编给大家讲ppt2010主题样式库的使用方法,有需要或者有兴趣的朋友们可以看一看下文,相信对大家会有所帮助的。ppt2010主题样式库的使用方法1、切换到演示文稿的&ldquo;设计&rdquo;选项卡,在&ldquo;主题&rdqu…

jquery使用iscorll实现上拉、下拉

jquery使用iscorll实现上拉、下拉

下拉加载,刷新,上拉,电脑软件,jquery,本文实例为大家分享了iscorll实现上拉下拉加载刷新的具体代码,供大家参考,具体内容如下实现原理是:判断fiiptop,flipdown是否显示为依据myScroll = new iScroll('wraphome', { fixedScrollbar:…

微信个性签名伤感短语伤感好听好看

微信个性签名伤感短语伤感好听好看

微信签名,流行,伤感,短语,个性签名,  最喜欢的音乐是你的声音,最喜欢的文字是你说过的话,最喜欢的路是和你一起走过的路,最喜欢的人是你。最伤心的事,是离开你。下面是小编整理的微信个性签名伤感短语的内容,希望能够帮到您。微信个性签名伤感…

nodejs mysql 实现分页的方法

nodejs mysql 实现分页的方法

方法,分页,电脑软件,nodejs,mysql,这两天学习了nodejs mysql 实现分页,很重要,所以,今天添加一点小笔记。代码如下var express = require('express');var router = express.Router();var settings = require('../settings.js');var mysql …

ASP.NET Core应用中与第三方IoC/DI

ASP.NET Core应用中与第三方IoC/DI

框架,第三方,中与,电脑软件,NET,一、ConfigureServices方法返回的ServiceProvider没有用!我们可以通过一个简单的实例来说明这个问题。我们先定义了如下这个一个MyServiceProvider,它实际上是对另一个ServiceProvider的封装。简单起见,我们利…

PS怎么利用两张照片合成佛光普照效

PS怎么利用两张照片合成佛光普照效

普照,照片,佛光,两张,效果,Photoshop软件作为一款比较强大的修图软件,它在修图方面有着无可比拟的优势,这也是它能给我们创新一个神奇世界的优势之处。以下小编&ldquo;林曌乐园&rdquo;便为大家分享一下如何使用PS软件制作&ldquo;佛光普照&rdq…

JS数组操作中的经典算法实例讲解

JS数组操作中的经典算法实例讲解

数组操作,经典算法,实例,电脑软件,JS,冒泡排序<script type="text/javascript">var arr = [3,7,6,2,1,5];定义一个交换使用的中间变量var temp = 0;for(i=0;i<arr.length;i++){ for(j=0;j<arr.length;j++){如果下一个元素小于当前元素 …

ppt2010怎样设置4比3模式PPT设置放

ppt2010怎样设置4比3模式PPT设置放

设置,模式,方法,比例,电脑软件,  ppt2013默认为宽屏我16:9,怎么才能设置成正常的4:3的显示呢?对于新手来说还是有一定难度,怎么办?不用着急,接下来小编举例简单的例子告诉大家ppt2010设置4 3模式的方法。ppt2010设置4比3模式的方法打开ppt20…