我有一个带有工具提示的 ImageButton。单击按钮时,工具提示保持可见并粘在页面上的鼠标上。我希望工具提示在单击按钮后消失,但找不到执行此操作的方法。
如有任何建议,我们将不胜感激! 标记:
<asp:TemplateField HeaderText="Mark as Read">
<ItemTemplate>
<asp:ImageButton ID="img_markAsRead" runat="server" ImageUrl="img/icons/eye.png" CssClass="tooltip" Width="20" ToolTip="Mark this Notification as Read" CommandName="Edit" CommandArgument='<%# Eval("notification_id")%>'/>
</ItemTemplate>
</asp:TemplateField>
CSS:
.ui-tooltip {
padding: 8px;
position: absolute;
z-index: 9999;
max-width: 300px;
-webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa;
}
代码隐藏:
protected void grdv_RowEditing(object sender, GridViewEditEventArgs e)
{
GridViewRow theRow = grdv_notifications.Rows[e.NewEditIndex];
ImageButton theButton = (ImageButton)theRow.FindControl("img_markAsRead");
string notificationNo = theButton.CommandArgument;
#region the clever sql statement to do the updates
#endregion
//reload the gridview
loadGridview();
//set the notification number
MasterPage master = (MasterPage)this.Master;
master.updateNotificationCount(grdv_notifications.Rows.Count);
}
最佳答案
根据您的 jQuery 标记和类名是“ui-tooltip”的事实,我猜您正在使用 jQuery UI 工具提示。在这种情况下,其中一个选项是“track”,您可以在初始化时将其设置为false...
$( document ).tooltip({
track: false
});
默认情况下这应该是 false,因此您必须将其设置为 true。
关于jquery - 单击图像按钮时工具提示保持可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41638153/