jquery - 单击图像按钮时工具提示保持可见

标签 jquery html css asp.net

我有一个带有工具提示的 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/

相关文章:

javascript - 如何使用 onchange 事件将附加表行的值存储在数组变量中?

javascript - 使用 JQuery 的响应式设计

html - 无论内容多少,如何使我的侧边栏与页脚对齐?

html - 如何更改导航栏链接悬停和事件状态

css - 如何去除使用线性渐变属性时出现的条纹

css - IIS 7 不会在生产环境中提供 kendo UI 图标

javascript - 如何在 jQuery 脚本中将 .val() 内的某些单词设为粗体?

javascript - 使用javascript打开多个div

jquery - 删除媒体查询导航栏中的所有空格

javascript - 如何使 DIV 向上扩展而不是向下扩展?