Hello everyone,
I'm new to jQuery but have written a fair bit of DOM JavaScript in the last few years. I'm using the following to successfully display a pop up bubble on a page.

I got the script from here: http://jqueryfordesigners.com/coda-popup-bubbles/

I would like to display a different bubble from various different a href points on the page. Obviously I can only mouse over one link at a time so using the .trigger class to call the process makes sense.

The tutorial recommends the following but I can't really get my head round it:

This effect could be perfected by changing the initial reset (popup.css()) code to read from the trigger element and approximate itís position. In my example, Iíve hardcoded it because I only have one on the page - but you may want to use this effect several times across your page.
Any help would be appreciated.

Many thanks

$(function () {
  $('.bubbleInfo').each(function () {
    // options
    var distance = 10;
    var time = 150;
    var hideDelay = 200;

    var hideDelayTimer = null;

    // tracker
    var beingShown = false;
    var shown = false;
    var trigger = $('.trigger', this);
    var popup = $('.popup', this).css('opacity', 0);

    // set the mouseover and mouseout on both element
    $([trigger.get(0), popup.get(0)]).mouseover(function () {
      // stops the hide event if we move from the trigger to the popup element
      if (hideDelayTimer) clearTimeout(hideDelayTimer);

      // don't trigger the animation again if we're being shown, or already visible
      if (beingShown || shown) {
      } else {
        beingShown = true;

        // reset position of popup box
          top: -100,
          left: -33,
          display: 'block' // brings the popup back in to view

        // (we're using chaining on the popup) now animate it's opacity and position
          top: '-=' + distance + 'px',
          opacity: 1
        }, time, 'swing', function() {
          // once the animation is complete, set the tracker variables
          beingShown = false;
          shown = true;
    }).mouseout(function () {
      // reset the timer if we get fired again - avoids double animations
      if (hideDelayTimer) clearTimeout(hideDelayTimer);
      // store the timer so that it can be cleared in the mouseover if required
      hideDelayTimer = setTimeout(function () {
        hideDelayTimer = null;
          top: '-=' + distance + 'px',
          opacity: 0
        }, time, 'swing', function () {
          // once the animate is complete, set the tracker variables
          shown = false;
          // hide the popup entirely after the effect (opacity alone doesn't do the job)
          popup.css('display', 'none');
      }, hideDelay);