Coder Social home page Coder Social logo

photo-viewer's Introduction

photo-viewer

基于jquery图片查看, 拖动, 缩放,旋转 1.样式文件

2.html 结构如下:

<div class="demo">
    <ul>
        <li class="img" img-url="img/1-b.jpg"><img src="img/1-m.jpg" style="width:100px;"></li>
        <li class="img" img-url="img/2-b.jpg"><img src="img/2-m.jpg" style="width:100px;"></li>
        <li class="img" img-url="img/3-b.jpg"><img src="img/3-m.jpg" style="width:100px;"></li>
        <li class="img" img-url="img/4-b.jpg"><img src="img/4-m.jpg" style="width:100px;"></li>
        <li class="img" img-url="img/5.png"><img src="img/5.png" style="width:100px;"></li>
    </ul>
</div>

3.需要引用的js

<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.mousewheel.min.js"></script>
<script src="js/photo-viewer-1.6.0.js"></script>

4.调用 <script>

$(document).ready(function() {

    $('.img').photoViewer({
	rate: 0.2, //缩放倍数,移动端手势缩放不调用此参数,默认值为0.2
	angle:15, //旋转角度,默认值为30
    });

})

</script>   

5.说明

缩略图包含属性:img-url,即原图地址, 如上 li 的父级 ul 中有5个子节点, 所以这5张图片将作为一组。 缩略图可以用 li 或别的标签包裹,或者直接写成

< img class="img" img-url="图片地址" src="缩略图"/> ...

ps: class="img" 最好是block或inline-block, 否则点击缩略图时,图片动画可能不是从小图处出现的。

demo: http://www.baoliaoday.com/photoviewer/

photo-viewer's People

Contributors

wky0218 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.