jquery AnythingZoomer 插件实现文字放大镜

2025-12-29 12:01:10

1、新建html文档。

jquery AnythingZoomer 插件实现文字放大镜

2、书写hmtl代码。

<div id="main-content">

  <h1>AnythingZoomer <span style="font-size: 20px;">v1.0</span></h1>

  <ul id="nav">

    <li class="cal"><a href="index.html">Calendar Demo</a></li>

    <li class="img"><a href="image.html">Image Demo</a></li>

    <li class="txt"><a href="text.html">Text Demo</a></li>

    <li class="dbl"><a href="double.html">Double Demo</a></li>

    <li class="use"><a href="use.html">Usage</a></li>

  </ul>

  <h2>Image Demo</h2>

  Mouse over to see zoomed in version, double click to toggle between large and small versions.

  <div id="wrap">

    <div id="small"> <img src="images/rushmore_small.jpg" alt="small rushmore" /> </div>

    <div id="mover">

      <div id="overlay"></div>

      <div id="large"> <img src="images/rushmore.jpg" alt="big rushmore" /> </div>

    </div>

  </div>

</div>

jquery AnythingZoomer 插件实现文字放大镜

3、书写css代码。

#wrap, #wrap2 { width: 600px; position: relative; }

#small, #small2 { position: relative; width: 100%; }

#large, #large2 { background: white; position: relative; width: 600px; }

#mover, #mover2 { position: absolute; top: 0; left: 0; width: 104px; height: 104px; overflow: hidden; z-index: 100; background: white; display: none; }

#overlay, #overlay2 { border: 1px solid blue; width: 102px; height: 102px; position: absolute; top: 0; left: 0; z-index: 200; }

#small p { font-size: 8px; }

caption { background: #1634D8; padding: 3px; color: white; font: 13px Helvetica, Sans-Serif; text-transform: uppercase; letter-spacing: 1px; }

.calendar { font-size: 13px; }

.calendar td, .calendar th { padding: 1px; border: 2px solid white; }

.calendar td a { display: block; padding: 3px; background: #900; color: white; }

#months-tables .calendar td a:hover, #months-tables .calendar td a[style]:hover { background: black !important; text-decoration: none; }

.day { text-align: center }

.past-day { background-color: #eee; }

#months-tables { width: 100%; }

#months-tables td { vertical-align: top; }

td { vertical-align: top; }

.single-month { padding-right: 10px; }

#small .calendar { font-size: 8px; }

#small .calendar td, #small .calendar th { width: 12px; height: 12px; border: 1px solid white; padding: 0; }

#small .calendar td a { padding: 0; display: block; width: 12px; height: 12px; }

#small .calendar td.day { background: #eee; }

#small .calendar td.past-day { background: #999; }

#small a { border: 0; }

#small .months-tables { width: auto; }

#small caption { font-size: 8px; white-space: nowrap; }

jquery AnythingZoomer 插件实现文字放大镜

4、书写并添加js代码。

<script src="js/zoomer.jquery.js"></script>

<script>

        $(function() {

                   

        $("#wrap").anythingZoomer({

       

          expansionSize: 30,

          speedMultiplier: 2.2

       

        });

       

        });

    </script>

jquery AnythingZoomer 插件实现文字放大镜

5、代码整体结构。

jquery AnythingZoomer 插件实现文字放大镜

6、查看效果。

jquery AnythingZoomer 插件实现文字放大镜

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢