Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

round corners, vertical text cleanup

  • Loading branch information...
commit 1d0330ff4ecc0a59f0c0f1163ada3f7008857452 1 parent e950dc7
@jschementi authored
Showing with 293 additions and 77 deletions.
  1. +54 −77 index.html
  2. +239 −0 jquery.corner.js
View
131 index.html
@@ -7,8 +7,9 @@
<script src="jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="colorbox/colorbox/jquery.colorbox.js" type="text/javascript"></script>
+ <script src="jquery.corner.js" type="text/javascript"></script>
- <link type="text/css" media="screen" rel="stylesheet" href="colorbox/example3/colorbox.css" />
+ <link type="text/css" media="screen" rel="stylesheet" href="colorbox/example5/colorbox.css" />
<script type="text/javascript">
$(document).ready(function(){
@@ -83,8 +84,6 @@
#sanfran .project,
#sanfran li.rss_item {
background-color: black;
- padding: 0.5em;
- margin-bottom: 0.5em;
}
#sanfran #navigation a {
background-color: black;
@@ -100,6 +99,14 @@
color: white;
}
+ #sanfran #home-photos a.flickr {
+ background-color: white;
+ border: 0;
+ }
+ #sanfran #home-photos a.flickr:hover {
+ background-color: #ff6600;
+ }
+
/* formal theme */
body#formal {
@@ -114,8 +121,6 @@
#formal .project,
#formal li.rss_item {
background-color: black;
- padding: 0.5em;
- margin-bottom: 0.5em;
}
#formal #navigation a {
background-color: black;
@@ -131,6 +136,15 @@
color: white;
}
+ #formal #home-photos a.flickr {
+ background-color: white;
+ border: 0;
+ }
+
+ #formal #home-photos a.flickr:hover {
+ background-color: #ff6600;
+ }
+
/* guitar theme */
#guitar #background .image {
@@ -256,7 +270,7 @@
.section {
position: relative;
border-left: 3em solid #0077CC;
- padding-left: 1em;
+ /* padding-left: 1em; */
margin-bottom: 1em;
min-height: 20em;
}
@@ -267,17 +281,18 @@
position: relative;
height: 0;
}
-
- .area:first-child, .island:first-child .rss_item:first-child {
- padding-top: 1em;
+/*
+ .area:first-child, .island:first-child li.rss_item:first-child {
+ margin-top: 1em;
}
- .area:last-child, .island:last-child, .rss_item:last-child {
- padding-bottom: 1em;
- }
+ .area:last-child, .island:last-child, li.rss_item:last-child {
+ margin-bottom: 0.5em;
+ }*/
- .area, .island, .rss_item {
- padding: 0 1em 2em 0;
+ .area, .island, .rss_item {
+ padding: 0.5em;
+ margin-bottom: 0.5em;
}
.island:hover, .rss_item:hover {
cursor: pointer;
@@ -303,11 +318,13 @@
width: 200px;
display: block;
padding-right: 0.5em;
+ white-space: nowrap;
position: absolute;
left: -4.17em;
top: 3em;
- background-color: #0077CC;
+ /* background-color: #0077CC; */
+
/* http://snook.ca/archives/html_and_css/css-text-rotation */
-webkit-transform: rotate(-90deg);
@@ -319,11 +336,15 @@
#home-writing {
float: left;
- width: 19em;
+ width: 21em;
margin-right: 1em;
}
#most-recent-post.section {
min-height: 0;
+ margin-bottom: 0;
+ }
+ #most-recent-post .rss_box {
+ padding-bottom:1em;
}
#most-recent-post.section h2 a {
z-index: 10;
@@ -336,10 +357,11 @@
#home-writing .article p {
margin: 0; padding: 0;
}
- #most-recent-post .rss_item {
+ #most-recent-post li.rss_item {
font-size: 1.75em;
+ margin-bottom:0;
}
- #most-recent-post .rss_item,
+ #most-recent-post li.rss_item,
#home-writing .article p,
#home-writing .rss_item {
color: gray;
@@ -395,7 +417,7 @@
color: gray;
font-size: 1.4em;
letter-spacing: -0.02em;
- margin: 0.5em 0.25em 0;
+ margin: 0.5em 0 0;
}
#home-about {
@@ -420,14 +442,15 @@
#home-photos a.flickr {
margin: 0.2em;
- padding: 0.2em;
+ padding: 1px;
+ border: 1px solid #aaa;
display: block;
float: left;
- border: 1px solid #ccc;
- background-color: white;
+ background-color: none;
}
#home-photos a.flickr:hover {
background-color: #ff6600;
+ border: 1px solid #ff6600;
}
#home-photos a.flickr img {
@@ -538,10 +561,7 @@
}
};
- $('.island').hover(islandMouseIn, islandMouseOut);
- $('li.rss_item').hover(islandMouseIn, islandMouseOut);
- $('.island').click(islandClick);
- $('li.rss_item').click(islandClick);
+ $('.island, li.rss_item').hover(islandMouseIn, islandMouseOut).click(islandClick);
})
</script>
@@ -564,7 +584,7 @@
'margin-left': '36px',
'width': '479px',
'height': '530px',
- 'background-position': '-210px -100px'
+ 'background-position': '-210px -135px'
});
$('#background .image').show();
}
@@ -646,58 +666,9 @@
$('.rss_box li').removeAttr('style');
$('a.rss_item').removeAttr('target');
$('#home-writing .rss_box li:first-child').hide();
+ $('.rss_item p').hide();
});
</script>
- <!--
- <div class='article island'>
- <h3 class='title'><a href="1">MIX10 - IronRuby and IronPython - Part 1 (Intro)</a></h3>
- <p class="body">
- This past week I had the pleasure of attending and speaking at MIX10 in Las Vegas
- about using IronRuby and IronPython on the web. If you're a TV-person instead of
- a reading-person, here's a video of the talk ...
- </p>
- <div class='tags'>
- <a href=''>Python</a>, <a href=''>Ruby</a>, <a href="">IronRuby</a>, <a href=''>IronPython</a>, <a href=''>Silverlight</a>
- </div>
- </div>
-
- <div class='article island'>
- <h3 class='title'><a href="2">PyCon 2010 - Python in the browser</a></h3>
- <p class='body'>
- Last weekend I was very fortunate to speak at PyCon 2010 in Atlanta about writing
- browser-based applications in Python. A majority of the IronPython team was also there;
- Dino Viehland spoke about IronPython Tooling ...
- </p>
- <div class="tags">
- <a href=''>Python</a>, <a href=''>IronPython</a>, <a href=''>Silverlight</a>
- </div>
- </div>
-
- <div class='article island'>
- <h3 class="title"><a href='3'>What can you get with 10KB of Ruby or Python code?</a></h3>
- <p class='body'>
- $1000 and a trip to MIX 2010! 9 days left, an counting, to enter your minimalist creation
- into the MIX 10K Smart Coding Challenge. Do anything you want, it just has to be less than
- 10 kilobytes of source code...
- </p>
- <div class="tags">
- <a href=''>Python</a>, <a href=''>IronPython</a>, <a href=''>Silverlight</a>, <a href=''>MIX10</a>
- </div>
- </div>
-
- <div class='article island'>
- <h3 class="title"><a href='4'>IronRuby @ RubyConf 2009 - Part 4: Project status </a></h3>
- <p class='body'>
- It's been a long ride - starting in 2007 when IronRuby was introduced running in Silverlight.
- Things started out slowly, but for the last year we've moved pretty quick, have gotten great feedback,
- and IronRuby is due for another bump...
- </p>
- <div class="tags">
- <a href=''>Ruby</a>, <a href=''>IronRuby</a>, <a href=''>RubyConf2010</a>
- </div>
- </div>
- -->
-
</div>
</div>
@@ -854,5 +825,11 @@ <h3 class="title"><a href='4'>IronRuby @ RubyConf 2009 - Part 4: Project status
</div>
+
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $('.area, .island, li.rss_item').corner('round tr br 10px');
+ });
+ </script>
</body>
</html>
View
239 jquery.corner.js
@@ -0,0 +1,239 @@
+/*!
+ * jQuery corner plugin: simple corner rounding
+ * Examples and documentation at: http://jquery.malsup.com/corner/
+ * version 2.09 (11-MAR-2010)
+ * Requires jQuery v1.3.2 or later
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ * Authors: Dave Methvin and Mike Alsup
+ */
+
+/**
+ * corner() takes a single string argument: $('#myDiv').corner("effect corners width")
+ *
+ * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round).
+ * corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners)
+ * width: width of the effect; in the case of rounded corners this is the radius.
+ * specify this value using the px suffix such as 10px (yes, it must be pixels).
+ */
+;(function($) {
+
+var style = document.createElement('div').style;
+var moz = style['MozBorderRadius'] !== undefined;
+var webkit = style['WebkitBorderRadius'] !== undefined;
+var radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined;
+var mode = document.documentMode || 0;
+var noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
+
+var expr = $.browser.msie && (function() {
+ var div = document.createElement('div');
+ try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
+ catch(e) { return false; }
+ return true;
+})();
+
+function sz(el, p) {
+ return parseInt($.css(el,p))||0;
+};
+function hex2(s) {
+ var s = parseInt(s).toString(16);
+ return ( s.length < 2 ) ? '0'+s : s;
+};
+function gpc(node) {
+ while(node) {
+ var v = $.css(node,'backgroundColor');
+ if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
+ if (v.indexOf('rgb') >= 0) {
+ var rgb = v.match(/\d+/g);
+ return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
+ }
+ return v;
+ }
+ node = node.parentNode; // keep walking if transparent
+ }
+ return '#ffffff';
+};
+
+function getWidth(fx, i, width) {
+ switch(fx) {
+ case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width))));
+ case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width))));
+ case 'sharp': return Math.round(width*(1-Math.cos(Math.acos(i/width))));
+ case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
+ case 'slide': return Math.round(width*(Math.atan2(i,width/i)));
+ case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1))));
+ case 'curl': return Math.round(width*(Math.atan(i)));
+ case 'tear': return Math.round(width*(Math.cos(i)));
+ case 'wicked': return Math.round(width*(Math.tan(i)));
+ case 'long': return Math.round(width*(Math.sqrt(i)));
+ case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
+ case 'dogfold':
+ case 'dog': return (i&1) ? (i+1) : width;
+ case 'dog2': return (i&2) ? (i+1) : width;
+ case 'dog3': return (i&3) ? (i+1) : width;
+ case 'fray': return (i%2)*width;
+ case 'notch': return width;
+ case 'bevelfold':
+ case 'bevel': return i+1;
+ }
+};
+
+$.fn.corner = function(options) {
+ // in 1.3+ we can fix mistakes with the ready state
+ if (this.length == 0) {
+ if (!$.isReady && this.selector) {
+ var s = this.selector, c = this.context;
+ $(function() {
+ $(s,c).corner(options);
+ });
+ }
+ return this;
+ }
+
+ return this.each(function(index){
+ var $this = $(this);
+ // meta values override options
+ var o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase();
+ var keep = /keep/.test(o); // keep borders?
+ var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]); // corner color
+ var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]); // strip color
+ var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
+ var re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/;
+ var fx = ((o.match(re)||['round'])[0]);
+ var fold = /dogfold|bevelfold/.test(o);
+ var edges = { T:0, B:1 };
+ var opts = {
+ TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o),
+ BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o)
+ };
+ if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
+ opts = { TL:1, TR:1, BL:1, BR:1 };
+
+ // support native rounding
+ if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
+ if (opts.TL)
+ $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
+ if (opts.TR)
+ $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
+ if (opts.BL)
+ $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
+ if (opts.BR)
+ $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
+ return;
+ }
+
+ var strip = document.createElement('div');
+ $(strip).css({
+ overflow: 'hidden',
+ height: '1px',
+ minHeight: '1px',
+ fontSize: '1px',
+ backgroundColor: sc || 'transparent',
+ borderStyle: 'solid'
+ });
+
+ var pad = {
+ T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0,
+ B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0
+ };
+
+ if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
+ if (!keep) this.style.border = 'none';
+ strip.style.borderColor = cc || gpc(this.parentNode);
+ var cssHeight = $(this).outerHeight();
+
+ for (var j in edges) {
+ var bot = edges[j];
+ // only add stips if needed
+ if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
+ strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
+ var d = document.createElement('div');
+ $(d).addClass('jquery-corner');
+ var ds = d.style;
+
+ bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);
+
+ if (bot && cssHeight != 'auto') {
+ if ($.css(this,'position') == 'static')
+ this.style.position = 'relative';
+ ds.position = 'absolute';
+ ds.bottom = ds.left = ds.padding = ds.margin = '0';
+ if (expr)
+ ds.setExpression('width', 'this.parentNode.offsetWidth');
+ else
+ ds.width = '100%';
+ }
+ else if (!bot && $.browser.msie) {
+ if ($.css(this,'position') == 'static')
+ this.style.position = 'relative';
+ ds.position = 'absolute';
+ ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
+
+ // fix ie6 problem when blocked element has a border width
+ if (expr) {
+ var bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
+ ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
+ }
+ else
+ ds.width = '100%';
+ }
+ else {
+ ds.position = 'relative';
+ ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' :
+ (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';
+ }
+
+ for (var i=0; i < width; i++) {
+ var w = Math.max(0,getWidth(fx,i, width));
+ var e = strip.cloneNode(false);
+ e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
+ bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
+ }
+
+ if (fold && $.support.boxModel) {
+ if (bot && noBottomFold) continue;
+ for (var c in opts) {
+ if (!opts[c]) continue;
+ if (bot && (c == 'TL' || c == 'TR')) continue;
+ if (!bot && (c == 'BL' || c == 'BR')) continue;
+
+ var common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
+ var $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
+ switch(c) {
+ case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
+ case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
+ case 'BL': $horz.css({ top: 0, left: 0 }); break;
+ case 'BR': $horz.css({ top: 0, right: 0 }); break;
+ }
+ d.appendChild($horz[0]);
+
+ var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
+ switch(c) {
+ case 'TL': $vert.css({ left: width }); break;
+ case 'TR': $vert.css({ right: width }); break;
+ case 'BL': $vert.css({ left: width }); break;
+ case 'BR': $vert.css({ right: width }); break;
+ }
+ d.appendChild($vert[0]);
+ }
+ }
+ }
+ }
+ });
+};
+
+$.fn.uncorner = function() {
+ if (radius || moz || webkit)
+ this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
+ $('div.jquery-corner', this).remove();
+ return this;
+};
+
+// expose options
+$.fn.corner.defaults = {
+ useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
+ metaAttr: 'data-corner' // name of meta attribute to use for options
+};
+
+})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.