I'm migrating the existing Aflexi website to Drupal and at one point I came across an existing code which.. is not too ugly but hard to be integrated into its Menu feature. The code has a few divs that jQuery uses to create sliding effects, I could actually put them into the template page.tpl.php but using jQuery to inject them at the end of page is certainly a better practice.
So, in my template.php, I have:
$('#nav').append('lots.of.divs'); // Here's the injection
UiHelper.registerSlider('a.menu-1-1-2', '#sliderWso', '#pointerWso', 300);
By the way, I make the divs a one liner using:
echo 'paste your html' | tr -d '\n'
Then, talking about injection, this is brought into my attention as well - jQuery-AOP.