diff --git a/chosen/chosen.jquery.js b/chosen/chosen.jquery.js index 4efe36a..c38ae81 100644 --- a/chosen/chosen.jquery.js +++ b/chosen/chosen.jquery.js @@ -280,7 +280,7 @@ maxHeight = parseInt(this.search_results.css("maxHeight"), 10); visible_top = this.search_results.scrollTop(); visible_bottom = maxHeight + visible_top; - high_top = this.result_highlight.position().top; + high_top = this.result_highlight.position().top + this.search_results.scrollTop(); high_bottom = high_top + this.result_highlight.outerHeight(); if (high_bottom >= visible_bottom) { return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0); diff --git a/coffee/chosen.jquery.coffee b/coffee/chosen.jquery.coffee index 1ea7baf..b440f6c 100644 --- a/coffee/chosen.jquery.coffee +++ b/coffee/chosen.jquery.coffee @@ -250,17 +250,13 @@ class Chosen maxHeight = parseInt @search_results.css("maxHeight"), 10 visible_top = @search_results.scrollTop() visible_bottom = maxHeight + visible_top - - high_top = @result_highlight.position().top + + high_top = @result_highlight.position().top + @search_results.scrollTop() high_bottom = high_top + @result_highlight.outerHeight() - - #console.log visible_top, visible_bottom, high_top, high_bottom if high_bottom >= visible_bottom - #console.log "bottom is greater than bottom" @search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0 else if high_top < visible_top - #console.log "top is less than top" @search_results.scrollTop high_top result_clear_highlight: ->