code: function($menu) {
              // position to the lower middle of the trigger element
              if ($.ui && $.ui.position) {
                  // .position() is provided as a jQuery UI utility
                  // (...and it won't work on hidden elements)
                  $menu.css('display', 'block').position({
                      my: "center top",
                      at: "center bottom",
                      of: this,
                      offset: "0 5",
                      collision: "fit"
                  }).css('display', 'none');
              } else {
                  // determine contextMenu position
                  var offset = this.offset();
                  offset.top += this.outerHeight();
                  offset.left += this.outerWidth() / 2 - $menu.outerWidth() / 2;
                  $menu.css(offset);
              }
          }
docs: determine position to show menu at