Set jQuery code to fire after function has completed

I have the following function (I’ve removed code from the middle that is not important to my question):

function shadowBoxRefresh(){
    $  ("#sb-nav-next, #sb-nav-previous").click(function(){
            $  ('#sb-container').addClass("visibility_stay");
            $  ('#sb-overlay').addClass("opacity_stay");
            Shadowbox.close();
            Shadowbox.clearCache();
            shadowBoxSetup();
            setTimeout("Shadowbox.open(c)", 400)
            $  ('#sb-container').removeClass("visibility_stay");
            $  ('#sb-overlay').removeClass("opacity_stay");
        }
    });
}

My problem is, I need this part:

$  ('#sb-container').removeClass("visibility_stay");
$  ('#sb-overlay').removeClass("opacity_stay");

to fire after the rest of the function has completed. I’m wondering if a callback would do the job, but I’m not versed well enough in callbacks to know how to implement it.

Your help would be much appreciated.

newest questions tagged jquery – Stack Overflow

About Admin