jQuery document .ready and .resize in Wordpress
<p>Rather than repeat all my code for resize page, I tried this:</p>

<pre><code>$(document).ready(myfunction);
$(window).resize(myfunction);

function myfunction() {
    // do whatever
}
</code></pre>

<p>I'm having some issues.  I have some things that need to happen just when page loads (are always same) and some things that need to move on resize.  My page is setup like:</p>

<pre><code>jQuery(document).ready(function($) {

    //a bunch of static stuff here

    $wall.imagesLoaded(function(){
       //using an imagesloaded plugin
       //masonry is here &amp; needs to reload on resize.
    });

});
</code></pre>

<p>I read somewhere to always put that jQuery at the beginning for Wordpress, so I figured I might as well, since it worked.  How do I jiggle the rest so Masonry will reload on window resize?</p>

<p>Thanks!  </p>

<p><strong>Edit for a solution: This is working for Wordpress.</strong>  </p>

<pre><code>    (function($) {

    $(document).ready(documentReadyFunction);
    $(window).resize(windowResizeFunction);

    function documentReadyFunction() {
        // functions for document ready
        onPageLoadOrResize();
        onPageLoad();
    }

    function windowResizeFunction() {
        // functions for window resize
        onPageLoadOrResize();
    }

    function onPageLoad() {
        alert("pageload");
    }


    function onPageLoadOrResize () {
        alert ("Load or Resize");
    }

    })(jQuery);
</code></pre>
