jQuery - Running a function to replace commonly used code
<p>I have the following code below. Id like to replace the highlighted section with a single line of code that will run all that code. The reason behind this is because i reuse this code a lot, and would save me a lot of time by being able to copy and paste a single line of code.</p>

<p>Any ideas on the best way to write this?</p>

<p>This is the part i would like replacing with a single line of code.</p>

<pre><code>$(".menu-item-1").show();
$(".menu-item-2").show();
$(".menu-item-3").show();
$(".menu-item-4").show();
$(".menu-item-5").show();
$(".menu-item-6").show();
</code></pre>

<p>And the entirety of the code below.</p>

<pre><code>if (index == 2) {
$("#prev").show();
$("#next").show();
$(".menu-item-1").show();
$(".menu-item-2").show();
$(".menu-item-3").show();
$(".menu-item-4").show();
$(".menu-item-5").show();
$(".menu-item-6").show();
$("#p3-1").delay(1000).fadeIn("slow", function ()   {
    $("#p3-2").delay(500).fadeIn("slow", function ()    {
        $("#p3-3").delay(500).fadeIn("slow", function ()    {
            $("#p3-4").delay(500).fadeIn("slow", function ()    {
                $("#p3-5").delay(500).fadeIn("slow", function ()    {
                    $("#p3-6").delay(500).fadeIn("slow", function ()    {
                        $("#p3-7").delay(500).fadeIn("slow")
                        $("#next").show();
                    });
                });
            });
        });
    });
});
}
</code></pre>
