admin管理员组文章数量:1296457
I am wondering whether it is possible to bind mouseover event to one of the HTML element border, say, the left border of a div.
The div is a container for other plex html elements, and there are mouseover events attached for its sub elements. Binding mouseover event to the whole container div itself is a method, however the user will not be able to distinguish whether he select the container or the sub elements.
I want a very obvious method to indicate that the container can be selected, like highlighting the container when he mouseover the left border area.
Or is there any other good way to solve the problem?
Thank you.
I am wondering whether it is possible to bind mouseover event to one of the HTML element border, say, the left border of a div.
The div is a container for other plex html elements, and there are mouseover events attached for its sub elements. Binding mouseover event to the whole container div itself is a method, however the user will not be able to distinguish whether he select the container or the sub elements.
I want a very obvious method to indicate that the container can be selected, like highlighting the container when he mouseover the left border area.
Or is there any other good way to solve the problem?
Thank you.
Share Improve this question edited Jun 6, 2012 at 10:04 BoltClock 724k165 gold badges1.4k silver badges1.4k bronze badges asked Jun 6, 2012 at 6:46 George SunGeorge Sun 8711 gold badge12 silver badges20 bronze badges 3- what do u mean?? bind a the border of a div with events..? – Philemon philip Kunjumon Commented Jun 6, 2012 at 6:50
- Why not simply change the colour, or style, of the border or cursor on mouseover? – David Thomas Commented Jun 6, 2012 at 6:53
- Hi David, What I want is to highlight left border when user mouseover left border area of the div, but not when user mouseover the whole div. – George Sun Commented Jun 6, 2012 at 7:26
2 Answers
Reset to default 7Borders are not elements, and as such you cannot bind mouseenter events to them. If you wanted this type of functionality, you would need to place a series of elements around the edges of the element (or at least next to your target edge), and bind to that.
This particular approach was taken by Dropbox in their web-based upload feature. When you drag a file from your desktop onto their page, you'll notice that div
elements around the top, bottom, and sides all fade into view. This was acplished with four div
elements placed near the edges of the viewport.
do you want like this
http://jsfiddle/GBpcg/
EDIT : http://jsfiddle/GBpcg/2/
本文标签: javascripthtml mouseover event on element borderStack Overflow
版权声明:本文标题:javascript - html mouseover event on element border - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741639317a2389824.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论