Fix position issue when using up and down arrows to navigate the results.
This commit is contained in:
parent
ea87ad4df3
commit
d5b62668ca
|
@ -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);
|
||||
|
|
|
@ -251,16 +251,12 @@ class Chosen
|
|||
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: ->
|
||||
|
|
Loading…
Reference in a new issue