javascript - Scrolling in DropDownlist customize -


im using dropdownlist searching item , have problem problem how can scrolling in dropdownlist , down in keyboard?
jsfiddle

edit: since first solution wasn't working when more items added adjusted little. here's fiddle

what did:

first of all, checked position of storetarget , #search_results , logged console figure out causing problem. (this could've done btw...)
found out was, that, after couple of items, top position of storetargetitem higher visible area of #search_results.

so changed parameter of

 $("#search_results").scrolltop(storetarget.offset().top); 

to scroll little further current position , make smoother changed check in if-clause:

if(storetarget.offset().top>220){        $("#search_results").scrolltop($("#search_results").scrolltop()+40);        console.log(storetarget.offset().top);        console.log($("#search_results").scrolltop());        } 

i didn't check case when user goes up, that's left figure out.

here's working fiddle based on code

end edit

what did:

when moving or down keys check if offset().top value of storetarget greater or lesser 200 (you may change depending on size of list) , if so, scroll top of #search-results the
top of storetarget :

if(storetarget.offset().top>200){    $("#search_results").scrolltop(storetarget.offset().top); } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -