javascript - jQuery qTip 在键盘点击时显示/隐藏(输入键)
问题描述
我能够在鼠标单击时显示/隐藏 jQuery qTip,但 我想在单击 Enter 键以及单击鼠标时显示/隐藏 qTip。
有人可以帮我解决这个问题。
$('.LoginUserProfile').qtip({
content: {
text: '<span class = "login_jobTitle" title = ' + UserJobTitle + '>' + UserJobTitle + '</span><br/>',
title: 'My Profile',
//button: 'Close'
},
show: {
solo: true,
click: true,
},
show: 'click',
hide: {
event: 'click unfocus'
},
position: {
my: 'top right', // Position my top left...
at: 'bottom left', // at the bottom right of...
viewport: $(window)
},
style: {
classes: 'qtip-tipsy profile-dropdown',
tip: false
},
解决方案
下面是答案。
var showUserProfile = true;
$('.LoginUserProfile').keyup(function (e) {
if (e.keyCode === 13) {
if (showUserProfile) {
$('.LoginUserProfile').qtip("show");
showUserProfile = false;
}
else {
$('.LoginUserProfile').qtip("hide");
showUserProfile = true;
}
}
});
推荐阅读
- r - 将库(xlsx)表格内容和库(rvg)可编辑图形内容合并到同一个 Excel 选项卡上
- go - 如何将 sitemap.xml 发布到我的网站?
- javascript - 从特定标题值的表中抓取数据并过滤特定行(Google App Script)
- pytorch - Pytorch Geometric:如何从 pytorch 几何数据对象列表在 colab 笔记本中创建一个小型临时数据集
- javascript - Aframe 未注册组件
- flutter - 颤动中带有复选框动态的TextFormField
- python-3.x - 使用python从PDF中提取
- android - Mockito 无法模拟/监视,因为:-final class
- javascript - 唯一键没有像 postgres 中的其他字段一样更新
- sql - BigQuery 未在 LEFT JOIN 中返回缺失的 NULL 行