Jquery Qtip2作为上下文菜单未显示在Google Chrome上
环境: -jquery 1.9.1 -qtip2:2.0.1-35 我遇到了一个奇怪的问题,打开一个绑定为右键单击的qtip2(作为上下文菜单的替换,下面就是这样做的) 在firefox上,一切都很顺利,只要我右键单击目标元素,contextmenu就会显示出来。 在Chrome上,由于未知原因,我必须左键单击然后右键单击目标以获得qtip工作 奇怪的是,它在这两种浏览器上都能正常工作: 使用完全相同的源代码Jquery Qtip2作为上下文菜单未显示在Google Chrome上,jquery,google-chrome,firefox,qtip,right-click,Jquery,Google Chrome,Firefox,Qtip,Right Click,环境: -jquery 1.9.1 -qtip2:2.0.1-35 我遇到了一个奇怪的问题,打开一个绑定为右键单击的qtip2(作为上下文菜单的替换,下面就是这样做的) 在firefox上,一切都很顺利,只要我右键单击目标元素,contextmenu就会显示出来。 在Chrome上,由于未知原因,我必须左键单击然后右键单击目标以获得qtip工作 奇怪的是,它在这两种浏览器上都能正常工作: 使用完全相同的源代码 <!DOCTYPE html> <html> <he
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script src="jquery/jquery-1.9.1.js"></script>
<script type='text/javascript' src="jquery/jquery.qtip.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.qtip.css">
<style type='text/css'>
ul#candMenu {
display: none;
}
</style>
<script type='text/javascript'>
$(document).ready( function() {
$(document).on("mousedown", ".test", function(event) {
$(this).qtip({
content: {
text: $("#candMenu").clone()
},
show: {
event: "mouseup",
ready: true,
solo: true
},
hide: {
event: "unfocus" // Si qqchose d autre que le tooltip est cliqué
},
position: {
my: "left top",
target: "mouse", // Position it where the click was...
adjust: { mouse: false }, // ...but dont follow the mouse
viewport: $(window) // empêche le débordement de la fenêtre
},
events: {
show: function(eventShow, api) {
if(eventShow.originalEvent.which !== 3) {
eventShow.preventDefault();
}
}
}
}, event);
}).bind("contextmenu", function() { return false; });
});
</script>
</head>
<body>
<a href="javascript:;" class="test">Test right click</a><br />
<a href="javascript:;">No-test</a>
<table border="1" width="100%">
<tr class="test">
<td>prem</td>
<td>seco</td>
<td>third</td>
</tr>
<tr class="test">
<td>prem</td>
<td>seco</td>
<td>third</td>
</tr>
</table>
<UL id="candMenu">
<LI class="event separator"><A href="javascript:;">Événements<SPAN class="holdctrl"></SPAN></A></LI>
<LI class="edit"><A href="javascript:;">Infos du candidat<SPAN class="holdctrl"></SPAN></A></LI>
<LI class="permis"><A href="javascript:;">Demande de permis<SPAN class="holdctrl"></SPAN></A></LI>
<LI class="prod"><A href="javascript:;">Produits<SPAN class="holdctrl"></SPAN></A></LI>
<LI class="regle"><A href="javascript:;">Règlements<SPAN class="holdctrl"></SPAN></A></LI>
<LI class="form"><A href="javascript:;">Formation<SPAN class="holdctrl"></SPAN></A></LI>
</UL>
</body>
</html>
-JSFIDLE演示
ul#坎德菜单{
显示:无;
}
$(文档).ready(函数(){
$(文档).on(“mousedown”,“.test”,函数(事件){
$(此).qtip({
内容:{
文本:$(“#candMenu”).clone()
},
展示:{
事件:“鼠标悬停”,
准备好了吗,
索洛:是的
},
隐藏:{
事件:“未聚焦”//Si qqchose d autre que le tooltip est cliqué
},
职位:{
我的:“左上”,
目标:“鼠标”//将其放置在单击的位置。。。
调整:{mouse:false},//…但不要跟随鼠标
视口:$(窗口)//empêche le débordement de la fenêtre
},
活动:{
show:函数(eventShow,api){
if(eventShow.originalEvent.which!==3){
eventShow.preventDefault();
}
}
}
},事件);
}).bind(“contextmenu”,function(){return false;});
});
普莱姆
塞科
第三
普莱姆
塞科
第三
我还尝试在非SSL环境中使用相同的奇怪行为。
我找不到是否有fiddle环境上的技巧或我的服务器上的错误配置来解释这种差异。这是通过删除用户配置文件中与Chrome相关的所有文件后重新安装Chrome解决的