jquery仿京東商品頁面

来源:http://www.cnblogs.com/jianghongyan/archive/2017/06/05/6946348.html
-Advertisement-
Play Games

jquery仿京東商品頁面 京東頁面大家都很熟悉,進入商品頁面把滑鼠放在圖片上旁邊會出現一個放大的效果,接下來就帶大家看看怎麼實現的!!!! 仿京東商品頁面css的代碼!!! 仿京東商品頁面html的代碼!!! 仿京東商品頁面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.gif) 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.gif) 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.jpg" 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.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b2.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b3.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b1.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b2.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b3.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b1.jpg" height="52" width="52" />
                </li>
                <li>
                    <img src="img/b2.jpg" 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.png" height="300" width="1329" />
                </div>
            </div>
        </div>
    </div>
    <div class="xia">
        <img src="img/b1.jpg" 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();
    });
});

怎麼樣,當我做出來的時候感覺神清氣爽!!!!!

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...