admin管理员组文章数量:1415698
lets say we have an image of human body, i want when user hover over part of body (head,arm,etc), this organ turn green and when he clicks a defined action happens.
is it doable using javascript ? if so what would be the concept ?
reason for question :
Objective: this is all a small part of an existing project in which user inputs his medical history, so i want insteed of giving him a dropdown with all organs just show a model of human and he click and save his history of tramua etc..
to do that i think i will need an image of human body and to define the boundaries in X-Y of each organ represented on this image and give it some properties(name).
- User hover : boundaries of organ shows and color of bg is green for example
- when user click it calls that object form.
is there something similar existing in js-jquery ? or i need to invent the wheel ?
lets say we have an image of human body, i want when user hover over part of body (head,arm,etc), this organ turn green and when he clicks a defined action happens.
is it doable using javascript ? if so what would be the concept ?
reason for question :
Objective: this is all a small part of an existing project in which user inputs his medical history, so i want insteed of giving him a dropdown with all organs just show a model of human and he click and save his history of tramua etc..
to do that i think i will need an image of human body and to define the boundaries in X-Y of each organ represented on this image and give it some properties(name).
- User hover : boundaries of organ shows and color of bg is green for example
- when user click it calls that object form.
is there something similar existing in js-jquery ? or i need to invent the wheel ?
Share Improve this question edited Feb 23, 2013 at 20:13 Momen Zalabany asked Feb 23, 2013 at 20:07 Momen ZalabanyMomen Zalabany 9,02716 gold badges80 silver badges144 bronze badges2 Answers
Reset to default 4- You can use imagemaps. You define different areas inside image via co-ordinates.
- You can use canvas (HTML5, supported in modern browsers)
- You can use svg ( supported in modern browsers)
- A worse way, but may be the easiest one, to put absolutely positioned divs over the body image. (will always give rectangular shape)
You can use HTML Maps and bind a mouse event to the different areas to change the color and perform a different callback on click.
本文标签: javascriptdefine parts of an image and assign to hoverclick eventsStack Overflow
版权声明:本文标题:javascript - define parts of an image and assign to hover,click events - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745238192a2649162.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论