Custom dropdown box using javascript and css

2019-01-29 05:24发布

Is it possible to create a custom dropdown box using javascriit and css.

for which i need to place a background-image for dropdown box using javascript

If yes or no ? if yes . give any suggestion ?

without using JQuery

3条回答
闹够了就滚
2楼-- · 2019-01-29 05:27

You can check out jQTransform

查看更多
SAY GOODBYE
3楼-- · 2019-01-29 05:44

This might be overkill; but SproutCore gives you input elements composed from images instead of from native HTML elements. There are probably other frameworks that do similar things.

The basic idea is to create a div or something, as CrazyJugglerDrummer suggests, and put click handlers on it. The handlers set up animation to mimic a select element. And when one of your pseudo-select items is selected, you use JavaScript to send that value to an actual select or input element that is hidden.

查看更多
虎瘦雄心在
4楼-- · 2019-01-29 05:50

Here is a good tutorial on creating custom drop-down.

JQTransform (as suggested by Olafur) is sufficient for me. But if you need more control such as adding icons, it's worth looking at the tutorial.

查看更多
登录 后发表回答