This works for running the same code on both ready and resize:
$(document).ready(function() {
$(window).resize(function() {
// Stuff in here h
.ready(), .resize(), and others like .mouseover() are all just short-cuts for using the .bind() function (or .on() in jQuery 1.7+). .resize(function () {}) maps to .bind('resize', function () {}). Here is how your code would look using .on() wherever possible:
$(document).on('ready', function() {
$(window).on('resize', function() {
// Stuff in here happens on ready and resize.
}).trigger('resize'); // Trigger resize handlers.
});//ready
Here is a demo: http://jsfiddle.net/qMBtP/