Spi*_*rls 2 html javascript css asp.net jquery
我试图在悬停时显示图像上的选项但是当我悬停显示的选项时会保持闪烁
$('a').hover(function(event) {
var href = $(this).attr('href');
var top = $(this).next().css("bottom");
$(this).next().css("display", "block");
$(this).next().next().css({ 'top': '30px', 'display': 'block' });
},function() {
$(this).next().hide();
$(this).next().next().hide();
});
});
$('.SelectionAnimate').hover(function() { $(this).css("display", "block"); $(this).next().show(); });
Run Code Online (Sandbox Code Playgroud)
列表视图代码
<ItemTemplate>
<div style="float: left; position: relative; margin: 10px;" >
<div>
<a class="real" href='<%#"/ProfileTenModified/UserProfile/PhotoCross.aspx?in="+ Eval("Full_Image_Name") +"&mi=" + Eval("User_Id") +"&fd="+ Eval("Album")%>'>
<asp:Image ID="Image1" runat="server" ImageUrl='<%#"/ProfileTenModified/setP/"+ Eval("Slide_Thumb_Name") +".JPEG" %>'
BorderStyle="Solid" BorderWidth="1px" Width="172px" Height="172px" />
</a>
<asp:LinkButton CssClass="SelectionAnimate" ID="Selection" runat="server" Text="Set as Display"
OnCommand="ListViewThums_Selection_Command" CommandName="selection"></asp:LinkButton>
<asp:LinkButton CssClass="SelectionAnimate" ID="Deletion" runat="server" Text="Remove"
OnCommand="ListViewThumbs_Command"></asp:LinkButton>
</div>
<asp:HiddenField ID="HiddenFieldImageId" runat="server" Value='<%#Eval("Id") %>' />
</div>
</ItemTemplate>
Run Code Online (Sandbox Code Playgroud)
我使用了两者mouseenter并且hover都创造了相同的效果.有没有解决这个问题
您应用.hover()的a唯一.因此,当你将鼠标悬停在a图像上时,图像会显示在你的位置上,a这意味着你不再徘徊a了.这将触发第二个回调,.hover()图像将消失.然后你再次盘旋a,它无限重复.
要解决这个问题,您只需绑定.hover()父容器或两个元素.
| 归档时间: |
|
| 查看次数: |
1598 次 |
| 最近记录: |