You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
10 KiB
13 lines
10 KiB
4 years ago
|
/*!
|
||
|
jQThumb v2.3.6
|
||
|
Copyright (c) 2013-2016
|
||
|
Released under the MIT license.
|
||
|
|
||
|
Author : Pak Cheong
|
||
|
Version : 2.3.6
|
||
|
Repo : git@github.com:pakcheong/jqthumb.git
|
||
|
Demo : http://pakcheong.github.io/jqthumb/
|
||
|
Last Updated : Sunday, April 10th, 2016, 2:42:38 PM
|
||
|
Requirements : jQuery >=v1.3.0 or Zepto (with zepto-data plugin) >=v1.0.0
|
||
|
*/
|
||
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(function(){return"undefined"!=typeof jQuery?jQuery:"undefined"!=typeof Zepto?Zepto:$}())}(function(a){function b(a,b){window.console&&"undefined"!=typeof a&&a&&"undefined"!=typeof b&&b&&(a=a.toLowerCase(),"error"==a?console.error(b):"log"==a?console.log(b):console.error('"'+a+'" is not supported as console type.'))}function c(b){return b=a.trim(b.toString()),"auto"===b.toLowerCase()?b:parseFloat(b)}function d(a,b){var c=a.toString().match(/(-*)+\d+/)[0];return"px"==e(a)?0>a?0:a>b?b:a:"%"==e(a)?0>c?"0%":c>100?"100%":a:void 0}function e(b){var c=b.toString().match(/\d+(.*)/i);if(c)switch(a.trim(c[1])){case"":return"px";case"px":return"px";case"%":return"%"}return""}function f(b,c){a.fn[i].defaults=a.extend({},y,a.fn[i].defaults),this.element=b,this.settings=a.extend({},a.fn[i].defaults,c),this.settings.onDemandEvent=this.settings.onDemandEvent.toLowerCase(),this.settings.threshold=this.settings.threshold.toString().replace(/px/gi,""),this.settings.width=this.settings.width.toString().replace(/px/gi,""),this.settings.height=this.settings.height.toString().replace(/px/gi,""),this.settings.width||(c.width=y.width,this.settings.width=y.width),this.settings.height||(c.height=y.height,this.settings.height=y.height),this.settings.position.y=d(this.settings.position.y,this.settings.width),this.settings.position.x=d(this.settings.position.x,this.settings.height),this.settings.zoom=this.settings.zoom<0?0:this.settings.zoom,"string"==typeof c?"kill"==c.toLowerCase()&&this.kill(this.element):(a(this.element).data(r,this.settings),this.init(this.element,this.settings))}var g=function(){var a=document.createElement("div"),b="Khtml Ms O Moz Webkit".split(" ");b.length;return function(c){if(c in a.style)return!0;c=c.replace(/^[a-z]/,function(a){return a.toUpperCase()});for(var d in b)if(b[d]+c in a.style)return!0;return!1}}();a.fn.outerHeight&&a.fn.outerWidth||("function"!=typeof Array.prototype.forEach&&(Array.prototype.forEach=function(a){for(var b=0;b<this.length;b++)a.apply(this,[this[b],b,this])}),["width","height"].forEach(function(b){var c=b.replace(/./,function(a){return a[0].toUpperCase()});a.fn["outer"+c]||(a.fn["outer"+c]=function(){var a=this;if(a){var c=a[b](),d={width:["left","right"],height:["top","bottom"]};return d[b].forEach(function(b){c+=parseInt(a.css("margin-"+b),10),c+=parseInt(a.css("padding-"+b),10),c+=parseInt(a.css("border-"+b+"-width"),10)}),c}return null})})),a.fn.unwrap||(a.fn.unwrap=function(){this.parent().each(function(){a.nodeName(this,"body")||a(this).replaceWith(this.childNodes)}).end()});var h=function(b,d){var e=a(window),f=b.offset(),g={top:e.scrollTop(),left:window.scrollX};return g.right=g.left+e.width(),g.bottom=g.top+e.height(),f.right=f.left+b.outerWidth(),f.bottom=f.top+b.outerHeight(),d=d?c(d):0,!(g.right<f.left-d||g.left>f.right+d||g.bottom<f.top-d||g.top>f.bottom+d)},i="jqthumb",j=a(window),k=function(){for(var a=["scroll","resize","scrolltop"],b={},c=0;c<a.length;c++)b[a[c]]=a[c]+"."+i;return b}(),l=function(){var b=[];return a.each(k,function(a,c){b.push(c)}),b.join(" ")}(),m="click."+i,n="mouseenter."+i,o=i+"-render-position",p=i+"-original-styles",q=i+"-inviewport",r=i+"-options",s=i+"-status",t=i+"-onetime-event",u=i+"-ongoing-event",v=i+"-responsive",w=i+"tmp-img",x={outputElems:[],inputElems:[]},y={classname:i,width:100,height:100,position:{x:"50%",y:"50%"},source:"src",responsive:20,zoom:1,show:!0,renderPosition:"before",onDemand:!1,onDemandEvent:"scroll",threshold:0,method:"auto",reinit:!0,error:function(){},before:function(){},after:function(){},done:function(){}};f.prototype={kill:function(c){function d(a){j.unbind(l,a.data(u)),j.unbind(k.resize,a.data(v)),a.parent().unbind(m,a.data(t)),a.parent().unbind(n,a.data(t)),a.removeAttr("style"),a.data(p)||(a.attr("style",a.data(p)),a.removeData(p)),a.data(i)&&a.removeData(i),a.data(r)&&a.removeData(r),a.data(q)&&a.removeData(q),a.data(o)&&a.removeData(o),a.data(s)&&a.removeData(s),a.data(t)&&a.removeDat
|