js/cornerz.js
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/**
* Cornerz 0.6 - Bullet Proof Corners
* Jonah Fox (jonah@parkerfox.co.uk) 2008
*
* Usage: $('.myclass').curve(options)
* options is a hash with the following parameters. Bracketed is the default
* radius (10)
* borderWidth (read from BorderTopWidth or 0)
* background ("white"). Note that this is not calculated from the HTML as it is expensive
* borderColor (read from BorderTopColor)
* corners ("tl br tr bl"). Specify which borders
* fixIE ("padding") - attmepts to fix IE by incrementing the property by 1 if the outer width/height is odd.
CHANGELIST from v0.4
0.5 - Now attempts to fix the odd dimension problem in IE
0.6 - Added semicolons for packing and fixed a problem with odd border width's in IE
*/
;(function($){
if($.browser.msie && document.namespaces["v"] == null) {
document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
var ss = document.createStyleSheet().owningElement;
ss.styleSheet.cssText = "v\\:*{behavior:url(#default#VML);}"
}
$.fn.cornerz = function(options){
function canvasCorner(t,l, r,bw,bc,bg){
var sa,ea,cw,sx,sy,x,y, p = 1.57, css="position:absolute;";
if(t)
{sa=-p; sy=r; y=0; css+="top:-"+bw+"px;"; }
else
{sa=p; sy=0; y=r; css+="bottom:-"+bw+"px;"; }
if(l)
{ea=p*2; sx=r; x=0; css+="left:-"+bw+"px;"}
else
{ea=0; sx=0; x=r; css+="right:-"+bw+"px;"; }
var canvas=$("<canvas width="+r+"px height="+ r +"px style='" + css+"' ></canvas>");
var ctx=canvas[0].getContext('2d');
ctx.beginPath();
ctx.lineWidth=bw*2;
ctx.arc(sx,sy,r,sa,ea,!(t^l));
ctx.strokeStyle=bc;
ctx.stroke();
ctx.lineWidth = 0;
ctx.lineTo(x,y);
ctx.fillStyle=bg;
ctx.fill();
return canvas;
};
function canvasCorners(corners, r, bw,bc,bg) {
var hh = $("<div style='display: inherit' />"); // trying out style='float:left'
$.each(corners.split(" "), function() {
hh.append(canvasCorner(this[0]=="t",this[1]=="l", r,bw,bc,bg));
});
后面还有 105 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。