在 gridview 项目模板中,当 div 设置为不显示时,如何在鼠标悬停时显示/隐藏 div
box div 将在页面加载期间隐藏,当我们将鼠标悬停在其上时,它应该显示,onmouseover 时它应该显示,onmouseout 时它应该隐藏。任何人都可以建议我如何在 jquery 中执行此操作,我是 Jquery 的初学者:)
更新此 Div 放置在 gridview 的 ItemTemplate 中。会起作用吗?你们提供了哪些答案?
<div id="box" style="display: none">
<a href="#" class="bt btleft">Highlight it</a>
<a href="#" class="bt btright">Reset</a>
</div>
box div will be hidden during pageload, when we hover on it it should display, onmouseover it should display, and onmouseout it should be hidden. can any body suggest me how to do in jquery, i am beginner in Jquery :)
Update this Div is placed in ItemTemplate of gridview. will it be worked ? with answeered which you people provide ?
<div id="box" style="display: none">
<a href="#" class="bt btleft">Highlight it</a>
<a href="#" class="bt btright">Reset</a>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你最好在CSS中使用visible属性,而不是从display:none开始,因为display:none会删除容器本身的空间。
试试这个
http://jsfiddle.net/sfUHn/7/
您的 HTML 应该如下
所示jquery 看起来像这样
希望这有帮助
you are better off using visible property in CSS rather than display:none to start with because display:none will sort of remove the space of the container itself.
try this out
http://jsfiddle.net/sfUHn/7/
Your HTML should look like this
You jquery will look like this
Hope this helps
修改html有点像
jquery部分
DEMO
modify the html a bit like
jquery part
DEMO
将其包装在另一个 div 中并在该 div 上绑定鼠标悬停事件
wrap it in another div and bind a mouseover event on that div
试试这个,最简单的..
Try this, the simplest one..
用另一个
div
包裹div
并将代码添加到包裹的div
中:Wrap the
div
with anotherdiv
and add the code to that wrappeddiv
: