if (winHeight - element.height() < parseInt(element.css('top'), 10)) {
        // We're too short switch to being bottom aligned
          element.css({
            top: 'auto',
            bottom: '10px',