Hi there,
According your attachments, I understand that you don't need any JavaScripts to make this dropdown work. It is already in working order as I see.
However, you need to style it up with CSS. I can answer you if I can see the live demonstration.
I can write custom JavaScript if neccessarry. Happy to discuss further about this project. Please say hi when you are available.
Thanks!