Coder Social home page Coder Social logo

movepic's Introduction

movePic

一个鼠标移动到图片上显示放大效果的 jQuery 插件,很多电商网站都有这个效果。

DEMO

http://yongyuan.us/demo/movePic

使用

1.引入 jQuery 文件

2.引入 jquery.movePic.js文件

3.具体示例

<div class="movePic">
    <div id="demo" data-src="image.jpg" style="width: 200px"><img src="image.jpg" alt=""></div>
</div>

建议设置拥有 data-src 标签的宽度和里面 img 宽度一样

使用插件默认的图片大小和颜色

 $(function () {
        $("#demo").movePic()
    })

如果要改成自己喜欢的颜色可以这样设置,把里面对应的值改成你需要的值

$("#demo").movePic({
      // 鼠标样式变量
        shadeColor: "#57ad68",
        shadeBorder: "#57ad68",
        shadeOpacity: 0.5,
        cursor: "move",
        // 大图的样式变量
        layerWidth: 400,
        layerHeight: 300,
        layerBorder: "#ddd",
        fade: true,

        largeWidth: 1280,
        largeHeight: 960
});

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.