A couple quick lines of jQuery allows you to free up real estate on your site (useful for mobile layouts) and add some interactivity at…
CFDocument image quality
If you find that your CFDocument PDF output bears poor image quality, it may be a quick fix. Double check the resolution on your image.…
jQuery: Make the first list element expand / collapse the other list elements
$('ul li:first-child').click(function() { $(this).siblings().toggle(); });
Javascript Optimization Tip: Merging JS files
A major component of optimizing your client side scripts (JavaScript) is reducing the number of http connections required. In other words, reducing the number of…
Remove indenting on UL and OL tags
ol { margin: 0; padding: 0; list-style-position: inside; } By default, most browsers indent list elements from the left margin. The magic above is the…
Add content type icons to your links on the fly
Of course, there are simple and tedious ways to do this, such as: HTML <a href="test.pdf" class="pdf">Download PDF</a> CSS .pdf { background: url('/src/img/icon-pdf.png') no-repeat; padding-left:…
Eliminate page centering “jumps”
body { overflow-y: scroll; } How annoying is it when you link from a "short" page to a "long" page and the vertical scrollbar "jumps"…
Use jQuery to highlight the current navigation item
$('a').each(function() { if(document.URL.indexOf($(this).attr('href')) >= 0) $(this).addClass('selected'); }); Note: This code will add the 'selected' css class to all <a> tags which link to…
Registered (®) and Trade (™) marks / superscript line spacing
sup { position: relative; height: 0; bottom: 1ex; line-height: 1em; vertical-align: baseline; _vertical-align: bottom; /* ie6 hack */ } If you want to adjust…
Normalizing a string (PHP)
We'll present one algorithm below which demonstrates the use of a loop and the ord function to step through the characters in a string. In…