Combine Slide and Fade Functions

$.fn.slideFadeToggle  = function(speed, easing, callback) {
        return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
}; 

Usage

$("#something").click(function() {
   $(this).slideFadeToggle();
});
Avatar of Chris Coyier
Chris Coyier on

Search/Replace

jQuery(function () { 
    jQuery(":contains(FIND)").not(":has(:contains(FIND))").each(function () { 
        var that = $(this), 
            html = that.html(); 
         
        html = html.replace(/(\(FIND:.*?\))/g, "REPLACE-WITH"); 
        that.html(html); 
    }); 
});
Avatar of Chris Coyier
Chris Coyier on

New Poll: Server Side Languages

A bit of a cookie-cutter poll this time, but sometimes those lead to the biggest and most interesting discussions. This is for the folks around here who are more of web developers than web designers:

What is your server-side language

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Insert Element Every nth Loop

When inside of a loop, you can keep track of the iteration number of the loop (shown below is a simple for loop). Using that iteration number, you can calculate it’s modulus of some number (number left over after an …

Avatar of Chris Coyier
Chris Coyier on

CSS Off Update

I was telling everyone to check back Wednesday for CSS Off results. Well… #facepalm. Huge apologies, we still aren’t quite ready. As it turns out judging 136 entries is quite a huge task. The important bit: come hell or high …

Avatar of Chris Coyier
Chris Coyier on

Rabble Rabble Rabble!

CSS3 is a big mess! 4+ rules for making a corner round or adding a drop shadow! Preposterous! Where are the standards?!

I’ve been hearing a ton of that. There is something of a point here. We all like standards, …

Avatar of Chris Coyier
Chris Coyier on

Remove Whitespace from Function Output

In WordPress, there are many functions which output things for you. For example, wp_list_pages() outputs a list of all your published pages. The HTML markup it spits out is pretty nicely formatted (meaning: has line breaks and indenting).

There are …

Avatar of Chris Coyier
Chris Coyier on