| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
cncde
9年前发布

让图片真正自适应的jQuery插件:ResponsifyJS

一个jquery插曲件让图片能够真正自适应,不会牺牲图像的主要部分。

在线演示:http://responsifyjs.space/#demo 

让图片真正自适应的jQuery插件:ResponsifyJS

How to use

  1. Use this interactive web app to generate the focus area data http://responsifyjs.space/app/

    <img src="image.png" alt=""     data-focus-left=".30" data-focus-top=".12" data-focus-right=".79" data-focus-bottom=".66" />

    data-focus-leftis the focus area's left position comparing to the image's full width, in decimal. For example, if the full width is 300px, the focus area's left is 90, then thedata-focus-leftshould be 90/300 =0.3. Same logic applies to other three data attributes.

  2. Embed the responsify.js in the html

    <script src="responsify.js"></script>
  3. Call responsify function when window object is loaded

    $(window).load(function() {      $('img').responsify();    });
  4. Call responsify function again when the window is being resized (optional)

    $(window).resize(function(){      $('img').responsify();    })

项目主页:http://www.open-open.com/lib/view/home/1449017171202

 本文由用户 cncde 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1449017171202.html
图片展示jQuery插件 jQuery插件 ResponsifyJS