大佬教程收集整理的这篇文章主要介绍了jQuery自定义图片缩放拖拽插件imageQ实现方法(附demo源码下载),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
本文实例讲述了jQuery自定义图片缩放拖拽插件imageQ实现方法。分享给大家供大家参考,具体如下:
jQuery imageQ plugin * @name jquery-imageQ.js * @author Q * @date 2011-01-19 * maxRatio 最大放大比例 * minRatio 最小缩小比例 * changeRadio 每次变化幅度 * picUrl:图片地址,* picWidth:图片宽度,* picHeight:图片高度,* reset:是否重设图片 * */ (function($){ var status = false; $.fn.imageQ = function(options){ var defaults = { maxRatio:4,minRatio:4,changeRadio:0.2,picUrl:'',picWidth:306,picHeight:372,reset:false } var options=jQuery.extend(defaults,options); return this.each(function(){ status = true; $(this).attr('src',''); $(this).attr('src',options.picUrl); var naturalwidth = options.picWidth; var naturalheight = options.picHeight; var minwidth = Math.round(naturalwidth/options.minRatio); var minheight = Math.round(naturalheight/options.minRatio); var maxwidth = Math.round(naturalwidth*options.maxRatio); var maxheight = Math.round(naturalheight*options.maxRatio); if(options.reset) { $("#wrapDiv").css("width",naturalwidth+"px"); $("#wrapDiv").css("height",naturalheight+"px"); $("#wrapDiv").css("top",'0px'); $("#wrapDiv").css("left",'0px'); } else { $(this).css("width","100%"); $(this).css("height","100%"); $(this).wrap(""); $("#wrapDiv").before('以上是大佬教程为你收集整理的jQuery自定义图片缩放拖拽插件imageQ实现方法(附demo源码下载)全部内容,希望文章能够帮你解决jQuery自定义图片缩放拖拽插件imageQ实现方法(附demo源码下载)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。