-
Notifications
You must be signed in to change notification settings - Fork 1
/
jwquaketext.min.js
2 lines (2 loc) · 1.33 KB
/
jwquaketext.min.js
1
2
/* jwQuakeText Jerome "PJ" Williams http://www.jworksstudios.com/plugins/jwquaketext | https://github.com/jworksstudios/jwquaketext */
!function(t){t.fn.quake=function(a){var n=t.extend({random:!0,randomMin:-20,randomMax:20,even:null,odd:null,xShift:2,yShift:5},a);return this.each(function(){var a=t(this).text(),r=a.length,e="",o=0;for(i=0;i<r;i++)if(""!=a[i]&&" "!=a[i])if(n.random&&null==n.even&&null==n.odd){var s=Math.random()*n.randomMax*2+n.randomMin+1+"deg",f="transform:rotate("+s+"); -moz-transform:rotate("+s+"); -o-transform:rotate("+s+"); -ms-transform:rotate("+s+"); -webkit-transform:rotate("+s+");",l=Math.random()*n.xShift-n.xShift,m=Math.random()*n.yShift-n.yShift,d="position: relative; top: "+m+"px; left: "+l+"px;";e+='<span class = "quake" style = "'+f+d+'">'+a[i]+"</span>"}else{var l=Math.random()*n.xShift-n.xShift,m=Math.random()*n.yShift-n.yShift,d="position: relative; top: "+m+"px; left: "+l+"px;";if(null==n.even||null==n.odd)e+='<span class = "quake" style = "'+d+'">'+a[i]+"</span>";else{var s=1==o?n.even+"deg":n.odd+"deg";o^=1;var f="transform:rotate("+s+"); -moz-transform:rotate("+s+"); -o-transform:rotate("+s+"); -ms-transform:rotate("+s+"); -webkit-transform:rotate("+s+");";e+='<span class = "quake" style = "'+f+'">'+a[i]+"</span>"}}else" "==a[i]&&(e+='<span class = "quake"> </span>');t(this).html(e)})}}(jQuery);