jQuery: Setting string for function call
<p>My code seems flawed, I'm setting two functions with the same code inside. Can I combine them into one?</p>

<pre><code>// remove sets
$('body').on("click", "span.remove", function() {

    var self  = $(this),
        total = self.parents('ul').children('li').size(); // grab total number of li's

    // remove (set) li if total greater than 1, else remove exercise
    if(total &gt; 1)
        self.parent('li').fadeOut('slow', function() {

            // remove clicked .li and reset list order
            $(this).remove();
            reset();

        });

    else
        self.parents('section').fadeTo('slow', 0.33).slideUp('slow', function() {

            // remove clicked .li and reset list order
            $(this).remove();
            reset();

        });

});
</code></pre>

<p>Is it possible to do something like:</p>

<pre><code>if(total &gt; 1)
    var f = self.parent('li').fadeOut('slow', function()

else
    var f = self.parents('section').fadeTo('slow', 0.33).slideUp('slow', function()

f {

    // remove clicked .li and rest list order
    $(this).remove();
    reset();

});
</code></pre>
