Submit

var host = (("https:" == document.location.protocol) ? "https://secure." : "http://");document.write(unescape("%3Cscript src='" + host + "wufoo.com/scripts/embed/form.js' type='text/javascript'%3E%3C/script%3E"));

var q7p4k1 = new WufooForm(); q7p4k1.initialize({ 'userName':'chriscoyier', 'formHash':'q7p4k1', 'autoResize':true, 'height':'650', 'ssl':true}); q7p4k1.display(); …

Avatar of Chris Coyier
Chris Coyier on

The Heating Company Analogy

What helps a design business stay healthy and successful over time is having regular clients with regular monthly billable work. The one-off jobs might be more glamorous and more fun, but in the long run it’s probably your regulars that …

Avatar of Chris Coyier
Chris Coyier on

Clear Default Search String on Focus

$("#s")
    .val("Search...")
    .css("color", "#ccc")
    .focus(function(){
        $(this).css("color", "black");
        if ($(this).val() == "Search...") {
            $(this).val("");
        }
    })
    .blur(function(){
        $(this).css("color", "#ccc");
        if ($(this).val() == "") {
            $(this).val("Search...");
        }
    });
  1. Set value of field to “Search…”
  2. When field comes into focus, set color to
Avatar of Chris Coyier
Chris Coyier on

Find ID of Top-Most Parent Page

This will find what the ID is of the top-most parent Page, in a nested child page. For example, this page you are literally looking at is nested under

<?php

if ($post->post_parent)	{
	$ancestors=get_post_ancestors($post->ID);
	$root=count($ancestors)-1;
	$parent = $ancestors[$root];
} else 
Avatar of Chris Coyier
Chris Coyier on

Fade Image Into Another Image

Make a div that is the exact size of the image. This div will have a background image applied to it of the second image. Then put an inline image inside it.

<div id="kitten" style="background-image: url(dog.jpg);">
  <img src="/images/kitten.jpg" alt="Kitten" />
Avatar of Chris Coyier
Chris Coyier on (Updated on )

Get FeedBurner Subscriber Count with cURL

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'https://feedburner.google.com/api/awareness/1.0/GetFeedData?id=7qkrmib4r9rscbplq5qgadiiq4');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);
$content = curl_exec($ch);
$subscribers = get_match('/circulation="(.*)"/isU',$content);
curl_close($ch);

The $subscribers variable will then be your subscriber count, for echoing out (or whatever). You’ll need to replace the ID at the end of the second line …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Meyer Reset

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
Avatar of Chris Coyier
Chris Coyier on (Updated on )