轉載jQuery圖片放大外掛程式[twiPicZoom]

來源:互聯網
上載者:User

標籤:des   style   blog   http   java   color   

轉載http://xuzhihong1987.blog.163.com/blog/static/26731587201312821725913/ 功能說明:

      雙擊查看大圖,滑鼠滾動放大縮小,能夠切換到上一張和下一張,點擊右上方關閉,相容主流的瀏覽器。

 

效果:

(例子一效果)

 

 (例子二效果:注,如果第一張的時候,左側就不會顯示前一張箭頭,最後一張類似 

 

如何使用:(include)

      1、樣式 twiPicZoom.css      

      2、jQuery的類庫,不一定要用1.8.3,其他的版本也行。

      3、滑鼠滾動放大縮小需要用到 jquery.mousewheel.js

    4、核心 jquery.twiPicZoom.js

    <link href="../../twiPicZoom/twiPicZoom.css" rel="stylesheet" type="text/css" />

    <script src="../../jquery-1.8.3.min.js" type="text/javascript"></script>

    <script src="../../twiPicZoom/jquery.mousewheel.js" type="text/javascript"></script>

    <script src="../../twiPicZoom/jquery.twiPicZoom.js" type="text/javascript"></script>

 

在代碼中對選擇的對像直接使用twiPicZoom()方法。

$(function () {

     $(‘img[type="twiPicZoom"]‘).twiPicZoom();

});

 

 

例子1:

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <link href="../../twiPicZoom/twiPicZoom.css" rel="stylesheet" type="text/css" />

    <script src="../../jquery-1.8.3.min.js" type="text/javascript"></script>

    <script src="../../twiPicZoom/jquery.mousewheel.js" type="text/javascript"></script>

    <script src="../../twiPicZoom/jquery.twiPicZoom.js" type="text/javascript"></script>

    <title>查看圖片大圖</title>

    <script type="text/javascript">

        $(function () {

            $(‘img[type="twiPicZoom"]‘).twiPicZoom();

        });

    </script>

</head>

<body>

     <div id="imgContainer">

         <img style="width:160px;height:120px;" src="../../samplePictures/Desert.jpg" type="twiPicZoom"/>

         <img style="width:160px;height:120px;" src="../../samplePictures/Hydrangeas.jpg" type="twiPicZoom"/>

         <img style="width:160px;height:120px;" src="../../samplePictures/Lighthouse.jpg" type="twiPicZoom"/>

         <img style="width:160px;height:120px;" src="../../samplePictures/Jellyfish.jpg" type="twiPicZoom"/>

     </div>

</body>

</html>

 

 

例子2:(複雜的結構,選擇的不是圖片對象,也可配置屬性)

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <link href="../../twiPicZoom/twiPicZoom.css" rel="stylesheet" type="text/css" />

    <script src="../../jquery-1.8.3.min.js" type="text/javascript"></script>

    <script src="../../twiPicZoom/jquery.mousewheel.js" type="text/javascript"></script>

    <script src="../../twiPicZoom/jquery.twiPicZoom.js" type="text/javascript"></script>

    <title>查看圖片大圖/更改配置</title>

    <script type="text/javascript">

        $(function () {

            $(‘div[type="twiPicZoom"]‘).twiPicZoom({srcField:‘href‘});

        });

    </script>

    <style type="text/css">

        #imgContainer div

        {

            display:inline-block;    

        }

    </style>

</head>

<body>

    <div id="imgContainer">

         <div type="twiPicZoom" href="../../samplePictures/Desert.jpg">

             <img style="width:160px;height:120px;" src="../../samplePictures/Desert.jpg" />

             <h2>Desert</h2>

         </div>

         <div  type="twiPicZoom"  href="../../samplePictures/Hydrangeas.jpg">

             <img style="width:160px;height:120px;" src="../../samplePictures/Hydrangeas.jpg"/>

             <h2>Hydrangeas</h2>

         </div>

 

            

         <div  type="twiPicZoom" href="../../samplePictures/Lighthouse.jpg">

            <img style="width:160px;height:120px;" src="../../samplePictures/Lighthouse.jpg"/>

            <h2>Lighthouse</h2>

         </div>

 

         <div  type="twiPicZoom" href="../../samplePictures/Jellyfish.jpg">

            <img style="width:160px;height:120px;" src="../../samplePictures/Jellyfish.jpg"/>

            <h2>Jellyfish</h2>

         </div>

    </div>

</body>

</html>

 

 

 

源碼:

twiPicZoom 1.0 :http://www.kuaipan.cn/file/id_50389080302682261.htm

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.