![]() |
Corner.js 2.1 allows you to add corners (and also shading and shadow) to images on your webpages (alternatively: glossy.js). It uses unobtrusive javascript to keep your code clean. It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, IE 6+ and Safari. On older browsers, it'll degrade and your visitors won't notice a thing. CVI-lab: Get a fast impression of the effects and their illustration qualities. |
Shows some of the things "corner.js" does.

class = "corner"

class = "corner ishade50"

class = "corner ishadow20"

class = "corner ishade50 ishadow20"

class = "corner ishadow40 inverse"

class = "corner iradius16"

class =
"corner iradius24 ishadow33 inverse"

class =
"corner iradius20 ishadow33"

class =
"corner iradius8 ishade75 ishadow33"

class =
"corner iradius16 ishade66 ishadow30"

class =
"corner iradius32 ishade50 ishadow25"

class =
"corner iradius48 ishade33"

class =
"corners iradius32"

class =
"corners iradiae1010"

class =
"corners ibezel iborder1 icolorffffff"

Download "corner.js" and include it into your webpage.
<script type="text/javascript" src="corner.js"></script>
To add corners just add a class="corner" and an additonal class like "iradius16" to the image.
If you want flexibility, use "cvi_corner_lib.js" instead of "corner.js". You can make your images respond to user actions (e.g. changing one or more options when the image is hovered over).
cvi_corner.defaultRadius = 0; //INT 0-100 (px)
cvi_corner.defaultShadow = 0; //INT 0-100 (% opacity)
cvi_corner.defaultShade = 0; //INT 0-100 (% opacity)
cvi_corner.defaultInverse = false; //BOOLEAN
If cvi_filter_lib.js is loaded also...
cvi_corner.defaultFilter = null; //OBJ [{f='grayscale'},{f='emboss', s:1}...]
cvi_corner.add(image, options);
cvi_corner.add(document.getElementById("myimg"), { shadow: 75, shade: 20 });
<img onLoad="cvi_corner.add(this, { shadow: 75, shade: 20 });" ...>
cvi_corner.modify(image, options);cvi_corner.modify(document.getElementById("myimg"), { radius: 50 });
cvi_corner.remove(image);
Alternatively use "cvi_corners_lib.js" instead of "justcorners.js".
cvi_corners.defaultXradius = 16; //INT 0-100 (px)
cvi_corners.defaultYradius = 0; //INT 0-100 (px)
cvi_corners.defaultCorners = "1111"; //STR "0000"-"1111" [top left|top right|bottom left|bottom right]
cvi_corners.defaultBorder = 0; //INT 0-100 (px borderwidth)
cvi_corners.defaultColor = "#0000ff"; //STR "#000000"-"#ffffff" bordercolor
cvi_corners.defaultOpacity = 100; //INT 0-100 (% borderopacity)
cvi_corners.defaultBezel = false; //BOOLEAN
If cvi_filter_lib.js is loaded also...
cvi_cornerr.defaultFilter = null; //OBJ [{f='grayscale'},{f='emboss', s:1}...]
cvi_corners.add(image, options);
cvi_corners.add(document.getElementById("myimg"), { corners: "1010" });
<img onLoad="cvi_corners.add(this, { corners: "1010" });" ...>
cvi_corners.modify(image, options);cvi_corners.modify(document.getElementById("myimg"), { xradius: 20, yradius: 10 });
cvi_corners.remove(image);
If you are using the more flexible "cvi_corner_lib.js" instead of "corner.js" or "cvi_corners_lib.js" instead of "justcorners.js", you'll get access to additional features by the following support libraries (part of distribution):
filter : [{#1 filter options},{#2 filter options}...];
options e.g. {f: 'contrast', s: 1.5, ...}f == STRING filter name e.g. "invert" Default: null (required)
"invert" Reverses all colors of the image
"invertalpha" Reverses the transparency of the image
"grayscale" Converts the image into grayscale
"solarize" Solarizes the image by negating the colors
"sepia" Applies the well-known sepia coloring to the image
"threshold" Converts the image to black&white (s<1 == darker and s>1 == brighter)