c4cf39d819e7051bdf1f018a0cbdf09463b54731 tdreszer Tue Jun 28 15:18:00 2011 -0700 Fixed redmine 2813 note 23. The gene autocomplete dialog overflowed the page and had bad css. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 84bbf71..0eb6a12 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -1249,30 +1249,42 @@ //alert("posting form:"+$(thisForm).attr('name')); return postTheForm($(thisForm).attr('name'),obj.href); } return true; } $(document).ready(function() { var db = getDb(); if(jQuery.fn.autocomplete && $('input#suggest') && db) { if(newJQuery) { $('input#suggest').autocomplete({ delay: 500, minLength: 2, source: ajaxGet(function () {return db;}, new Object, true), + open: function(event, ui) { + var pos = $(this).offset().top + $(this).height(); + if (!isNaN(pos)) { + var maxHeight = $(window).height() - pos - 30; // take off a little more because IE needs it + var auto = $('.ui-autocomplete'); + var curHeight = $(auto).children().length * 21; + if (curHeight > maxHeight) + $(auto).css({maxHeight: maxHeight+'px',overflow:'scroll'}); + else + $(auto).css({maxHeight: 'none',overflow:'hidden'}); + } + }, select: function (event, ui) { setPosition(ui.item.id, commify(getSizeFromCoordinates(ui.item.id))); makeSureSuggestTrackIsVisible(); // jQuery('body').css('cursor', 'wait'); // document.TrackHeaderForm.submit(); } }); } else { $('input#suggest').autocomplete({ delay: 500, minchars: 2, ajax_get: ajaxGet(function () {return db;}, new Object, false), callback: function (obj) { setPosition(obj.id, commify(getSizeFromCoordinates(obj.id)));