1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name = "viewport" content = "initial-scale = 0.9">
<title>jQuery Corners</title>
<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1.2.6")</script>
<script src="jquery.corners.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.rounded').corners();
$('.rounded').corners(); /* test for double rounding */
$('table', $('#featureTabsContainer .tab')[0]).each(function(){$('.native').hide();});
$('#featureTabsContainer').show();
tab(0);
});
function tab(n) {
$('#featureTabsContainer .tab').removeClass('tab_selected');
$($('#featureTabsContainer .tab')[n]).addClass('tab_selected');
$('#featureElementsContainer .feature').hide();
$($('#featureElementsContainer .feature')[n]).show();
}
</script>
<style type="text/css" media="screen">
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;font-variant:normal;}sup {vertical-align:text-top;}sub {vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}body {font:13px/1.231 helvetica,arial,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}
body {
margin: 10px;
}
* html .body {
width: 45em;
}
.body {
max-width: 45em;
}
p {
margin-bottom: 0.7em;
}
h1 {
margin-bottom: 1em;
font-size: 138.5%;
font-weight:bold;
text-align: center;
}
code {
display: block;
background-color: #ddc;
margin: 10px;
padding: 5px;
}
dt {
font-weight:bold;
}
dd {
margin-left: 1em;
}
input {
vertical-align: middle;
}
ul {
margin-left: 1em;
}
ul li {
list-style: disc outside;
}
a.rounded, .button {
outline: none;
border: none;
text-decoration: none;
cursor: pointer;
white-space: nowrap;
vertical-align: middle;
display: -moz-inline-box;
display: inline-block;
overflow: visible;
}
.button {
color: #000;
background-color: #acc;
padding: 5px 7px;
}
.button:hover {
background-color: #cee;
}
.center {
margin-left: auto;
margin-right: auto;
}
.title {
background-color: #eee;
}
.benefits {
color: #fff;
background-color: #3F2929;
padding: 0 10px;
vertical-align: top;
}
a.tab {
background-color: #603F3F;
color: #fff;
font-size: 108%;
font-weight: bold;
padding: 5px 7px 4px 7px;
margin-top: 0.3em;
border-bottom: solid 2px #fff;
}
a.tab:hover {
background-color: #3F2929;
color: #ffff00;
}
a.tab_selected {
border-bottom-color: #3F2929;
background-color: #3F2929;
}
#featureTabsContainer {
display: none;
}
#featureElementsContainer {
background-color: #3F2929;
padding: 10px;
}
.feature {
background-color: #fff;
padding: 10px;
}
.swatches {
padding: 5px 0;
}
.swatches a {
background-color: #000;
color: #fff;
padding: 8px 12px;
}
</style>
</head>
<body>
<div class="body center">
<table>
<tr>
<td colspan=5 class="title rounded {15px top}" style="padding-top:15px">
<h1>jQuery Corners 0.3</h1>
</td>
</tr>
<!-- Safari corners miss the background color in the table row -->
<tr class="title">
<td>
</td>
<td class="benefits rounded {top 10px no-webkit}" style="padding-top:10px">
</td>
<td>
</td>
<td class="benefits rounded {top 10px no-webkit}" style="padding-top:10px">
</td>
<td>
</td>
</tr>
<tr class="title">
<td style="width:0.85em">
</td>
<td class="benefits">
<p>This jQuery plugin will easily create beautifully rounded corners.
No images or obtrusive markup necessary.</p>
<div><span style="font-weight:bold">Architectural features:</span>
<ul>
<li>Less than 8000 bytes after yui compression.</li>
<li>Beautiful and fast anti-aliasing for older or stubborn browsers.</li>
<li>Degrades well for browsers with javascript turned off.</li>
<li>Native browser corners used on Safari, iPhone, and Firefox 3.</li>
<li>Form and anchor buttons are easily styled and rounded.</li>
<li>Documentation and test coverage (this file).</li>
</ul>
</div>
</td>
<td style="width:0.85em">
</td>
<td class="benefits" style="white-space:nowrap">
<p>Works with:</p>
<ul>
<li>iPhone</li>
<li>Chrome</li>
<li>Firefox</li>
<li>Safari 2+</li>
<li>Opera 9.0+</li>
<li>Internet Explorer 6+</li>
<li>and probably more...</li>
</ul>
</td>
<td style="width:0.85em">
</td>
</tr>
<tr class="title">
<td>
</td>
<td class="benefits rounded {bottom 10px no-webkit}" style="padding-bottom:10px">
</td>
<td>
</td>
<td class="benefits rounded {bottom 10px no-webkit}" style="padding-bottom:10px">
</td>
<td>
</td>
</tr>
<tr>
<td colspan=5 class="title rounded {15px bottom}" style="padding-bottom:15px">
</td>
</tr>
</table>
</div>
<div class="body center" style="margin-top:0.5em">
<div id="featureTabsContainer">
<a href="javascript:" onclick="tab(0)" class="tab rounded {top transparent}">Introduction</a>
<a href="javascript:" onclick="tab(1)" class="tab rounded {top transparent}">Options</a>
<a href="javascript:" onclick="tab(2)" class="tab rounded {top transparent}">Buttons</a>
<a href="javascript:" onclick="tab(3)" class="tab rounded {top transparent}">Swatches</a>
<a href="javascript:" onclick="tab(4)" class="tab rounded {top transparent}">Miscellaneous</a>
</div>
<div id="featureElementsContainer" class="rounded {right bottom}">
<div class="feature">
Once jQuery and jQuery.corners scripts are loaded, rounding corners is easy.
<code>
<div style="background-color:#acc; padding:5px" class="rounded"><br />
Simple Example<br />
</div><br />
<script>$(document).ready( function(){<br />
$('.rounded').corners();<br />
});</script><br />
</code>
<div style="background-color:#acc;padding:5px" class="rounded">
Simple Example
</div>
<br />
The rounding algorithm accepts options.
<code>
<div style="background-color:#acc; padding:10px" class="rounded"><br />
Example with different x and y sizes.<br />
</div><br />
<script>$(document).ready( function(){<br />
$('.rounded').corners("30px 10px");<br />
});</script><br />
</code>
<div style="background-color:#acc;padding:10px" class="rounded {30px 10px}">
Example with different x and y sizes.
</div>
<br />
You may override the options in the element's class.
<code>
<div style="background-color:#acc; padding:10px" class="rounded {10px}"><br />
class="rounded {10px}"<br />
</div><br />
<script>$(document).ready( function(){<br />
$('.rounded').corners("4px");<br />
});</script><br />
</code>
<div style="background-color:#acc;padding:10px" class="rounded {10px}">
class="rounded {10px}"
</div>
</div>
<div class="feature">
Options are passed as a string. For example: <tt>"6px transparent top";</tt>
<br />
<br />
<dl>
<dt>5px</dt>
<dd>Sets the corner radius. Default is 5.</dd>
<dt>10px 6px</dt>
<dd>Sets the x and y radii to different values.</dd>
<dt>anti-alias</dt>
<dd>Corners are anti-aliased. Default.</dd>
<dt>transparent</dt>
<dd>For background images or hover states, use this transparent style.</dd>
<dt>no-native</dt>
<dd>Disables all of the following border-radius extensions. Mostly used for testing.</dd>
<dt>webkit</dt>
<dd>Enables use of <tt>-webkit-border-radius</tt> on compatible browsers such as Safari and iPhone. Currently disabled for Google Chrome. Default.</dd>
<dt>no-webkit</dt>
<dd>Will not use <tt>-webkit-border-radius</tt> on any browser.</dd>
<dt>mozilla</dt>
<dd>Enables use of <tt>-moz-border-radius</tt> on Firefox 3+ and other Mozilla based browsers. Default.</dd>
<dt>no-mozilla</dt>
<dd>Will not use <tt>-moz-border-radius</tt> on any browser.</dd>
<dt>top</dt>
<dt>right</dt>
<dt>bottom</dt>
<dt>left</dt>
<dt>top-left</dt>
<dt>top-right</dt>
<dt>bottom-left</dt>
<dt>bottom-right</dt>
<dd>Mix and match to round only specific corners.</dd>
</dl>
</div>
<div class="feature">
Anchor <tt><a></tt> elements can be turned into rounded buttons.
<code>
<a href="javascript:" onclick="alert('Hello, World!')" class="rounded {transparent} button"><br />
Press<br />
</a> for a greeting.
</code>
<span><a href="javascript:" onclick="alert('Hello, World!')" class="rounded {transparent} button">
Press
</a> for a greeting.</span><br />
<br />
Form buttons too. Input elements are transmogrified to an anchor.
Browsers without javascript render buttons like the square examples here.
<code>
<form action="?"><br />
<input type="submit" value="Submit" class="button">&nbsp;<br />
<input type="submit" value="Submit" class="rounded {transparent} button">&nbsp;<br />
<input type="button" value="Javascript" class="button" onclick="alert('OK!'); return false;">&nbsp;<br />
<input type="button" value="Javascript" class="rounded {transparent} button" onclick="alert('OK!'); return false;"><br />
</form><br />
</code>
<form action="?">
<input type="submit" value="Submit" class="button">
<input type="submit" value="Submit" class="rounded {transparent} button">
<input type="button" value="Javascript" class="button" onclick="alert('OK!'); return false;">
<input type="button" value="Javascript" class="rounded {transparent} button" onclick="alert('OK!'); return false;">
</form>
<br />
Anchors and buttons require CSS like so.
<code>
a.rounded, .button {<br />
outline: none;<br />
border: none;<br />
text-decoration: none;<br />
cursor: pointer;<br />
white-space: nowrap;<br />
vertical-align: middle; /* or top */<br />
display: -moz-inline-box;<br />
display: inline-block;<br />
overflow: visible; /* IE6 form button fix */ <br />
}<br />
.button {<br />
color: #000;<br />
background-color: #acc;<br />
padding: 5px 7px;<br />
}<br />
.button:hover {<br />
background-color: #cee;<br />
}
</code>
</div>
<div class="feature">
<div class="native">
Your browser has a supported border-radius extension. You deserve a cookie.
<div class="swatches">
<a href="javascript:" class="rounded {8px}">8</a>
<a href="javascript:" class="rounded {7px}">7</a>
<a href="javascript:" class="rounded {6px}">6</a>
<a href="javascript:" class="rounded {5px}">5</a>
<a href="javascript:" class="rounded {4px}">4</a>
<a href="javascript:" class="rounded {3px}">3</a>
<a href="javascript:" class="rounded {2px}">2</a>
<a href="javascript:" class="rounded {1px}">1</a>
</div>
<br />
</div>
jQuery Corners contains its own algorithm to create anti-aliased corners.
<span class="native">Native browser support has been disabled here.</span>
<div class="swatches">
<a href="javascript:" class="rounded {8px no-native}">8</a>
<a href="javascript:" class="rounded {7px no-native}">7</a>
<a href="javascript:" class="rounded {6px no-native}">6</a>
<a href="javascript:" class="rounded {5px no-native}">5</a>
<a href="javascript:" class="rounded {4px no-native}">4</a>
<a href="javascript:" class="rounded {3px no-native}">3</a>
<a href="javascript:" class="rounded {2px no-native}">2</a>
<a href="javascript:" class="rounded {1px no-native}">1</a>
</div>
<br />
If you plan on using a background image or hover state, this transparent style will do the trick.
<span class="native">Your browser has border-radius support and will normally display these like the first example.</span>
<div class="swatches">
<a href="javascript:" class="rounded {8px transparent no-native}">8</a>
<a href="javascript:" class="rounded {7px transparent no-native}">7</a>
<a href="javascript:" class="rounded {6px transparent no-native}">6</a>
<a href="javascript:" class="rounded {5px transparent no-native}">5</a>
<a href="javascript:" class="rounded {4px transparent no-native}">4</a>
<a href="javascript:" class="rounded {3px transparent no-native}">3</a>
<a href="javascript:" class="rounded {2px transparent no-native}">2</a>
<a href="javascript:" class="rounded {1px transparent no-native}">1</a>
</div>
<br />
Width, height, margin and padding attributes supported.
<div class="rounded {20PX}" style="margin:5px 0 0 50px; width:50px; height:50px; padding:20px; background-color:#000">
</div>
<br />
No-native floating right test.
<div class="rounded {20PX no-native}" style="float:right; margin:5px 0 0 50px; width:50px; height:50px; padding:20px; background-color:#000">
</div>
<br style="clear:both"/>
</div>
<div class="feature">
Obtain support and the latest version at: <a href="http://plugins.jquery.com/project/corners">http://plugins.jquery.com/project/corners</a>
<br />
<br />
There needs to be enough padding to insert corners otherwise the layout
will not look the same across browsers or with javascript disabled.
If jQuery.corners doesn't find enough padding and you have Firebug or Firebug Lite running,
an error will be logged to the console. Note that if your browser supports border-radius
extensions then you will need to apply "no-native" to the elements you want checked.
<br />
<br />
Elements can only be rounded once. This allows for easier ajax support since you can
use the same callback for $(document).ready and ajaxComplete.
<br />
<br />
If you're having trouble on your own pages, make sure you're not in
<a href="http://en.wikipedia.org/wiki/Quirks_mode">quirks mode.</a>
<br />
<br />
Fun things to try with this page:
View the source for more examples.
View it with an iPhone.
Turn off javascript and reload.
Increase or decrease the font size with your browser.
</div>
</div>
</div>
</body>
</html>
|