获取嵌套网格视图中图像鼠标悬停的动态详细信息
get dynamic details on image mouseover in nested gridview
我有一个嵌套的网格视图,当将鼠标悬停在 A 行中的图像上时,第一次页面不会加载任何弹出窗口,但是第二次将鼠标悬停在 A 行中的图像上会弹出正确的信息。
另一个问题是,当我将鼠标悬停在 A 行后将鼠标悬停在 B 行中的图像上时,A 行的详细信息会从 A 行弹出 B 行,但是当我第二次将鼠标悬停在 B行上时,会弹出正确的详细信息。
我将非常感谢对此问题的任何帮助,因为我已经尝试解决它一段时间了。
JSFIDDLE 链接下面是一个演示
这是问题的解决方案
$('img.imagepopupcontext').hover(function (e) {
// Begin mouseover function
// Grab the p tag with the id of 'dbInfo' in order
// to retrieve information from it later
var cvalue = $(this).parent().parent().attr('id'); //tr.innerGridRow parent
count++;
//$('#ctl00_ContentPlaceHolder1_txtcontextkey').val(cvalue);
//$('#ctl00_ContentPlaceHolder1_btnmodalclick').click();
// var img = $(this);
$.ajax({url:'callbackdynamicdata.aspx',context:this,data:({ ID: cvalue}),success:
function(data){
var html = '<div id="infopathpanel">';
html += data;
html += '</div>';
// Append the variable to the body and the select
// itself and its children and hide them, so you
// can then add a fadeIn effect.
$('body')
.append(html)
.children('#infopathpanel')
.hide()
.fadeIn(400);
// This is where the popup offesets away from your cursor
// The variables set up top will decide how far away the
// pop up strays away from your cursor.
var pos = $(this).offset();
$('#infopathpanel').css({
position: "absolute",
top: (pos.top - 170) + "px",
left: (pos.left - 310) + "px",
'background-color': '#ffffcc',
'width': '300px',
'border-color': '#060F40',
'border-width': '2px',
'color': '#060F40'
});
}})
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var offsetY = -20;
var offsetX = 40;
var html = '<div id="info" class="InfoMessage"><h4>Info here </h4><p></p></div>';
$(html).hide().appendTo('body');
$('img.imagepopupcontext').hover(function (e) {
$('div.InfoMessage').hide().find('p').text($(this).data('message'));
$('div.InfoMessage').fadeIn(400);
$('div.InfoMessage').css('top', e.pageY + offsetY).css('left', e.pageX + offsetX);
}, function () {
$('#info').hide();
});
$('img.imagepopupcontext').mousemove(function (e) {
$('div.InfoMessage').css('top', e.pageY + offsetY).css('left', e.pageX + offsetX);
});
});
</script>
<style type="text/css">
#info
{
background: #7F7777;
width: 300px;
padding-bottom: .5em;
padding-right: 15px;
overflow: hidden;
position: absolute;
}
</style>
</head>
<body>
<table border="1" bgcolor="skyblue">
<tr>
<td>
in progress
</td>
<td>
Sale
</td>
</tr>
<tr>
<td>
in progress
</td>
<td>
<table border="1" bgcolor="orange">
<tr>
<td>
inner table a
</td>
<td>
inner table2 A
</td>
<td>
<img class="imagepopupcontext" src="http://cdn1.iconfinder.com/data/icons/SOPHISTIQUENIGHT/mail_icons/png/16/pop_documents.png"
data-message="Show dynamic information A a" />
</td>
</tr>
<tr>
<td>
inner table b
</td>
<td>
inner table2 B
</td>
<td>
<img class="imagepopupcontext" src="http://cdn1.iconfinder.com/data/icons/SOPHISTIQUENIGHT/mail_icons/png/16/pop_documents.png"
data-message="Show dynamic information B b" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="divshowpopup">
<p id="dbInfo">
</p>
</div>
</body>
</html>
相关文章:
- 当加载带有hastags的动态内容-URI时,Jquery-悬停效果不起作用
- 动态加载的缩略图显示其他缩略图的全尺寸图像,而不是自己的缩略图(使用javascript悬停效果)
- 悬停样式应该在动态加载多级菜单时保持单击状态
- jQuery-悬停在动态创建的元素setTimeout上
- 使用 dojo 将鼠标悬停在动态下拉列表选择上时添加工具提示
- 如何在鼠标悬停时动态向标题添加文本
- 通过检查cookie动态更改jQuery“悬停”
- Jquery 插件悬停卡在动态生成的内容中不起作用
- 当我将鼠标悬停在动态创建的行上时,行中的选择元素(标签)选项无法正确下拉.火狐问题
- 悬停打开 DIV 时,DIV 内容应从单独的 URL 动态加载
- 获取嵌套网格视图中图像鼠标悬停的动态详细信息
- 如何使 li 元素悬停在动态
- 平板电脑友好的悬停工具提示,显示基于javascript函数结果的动态文本
- 悬停在动态添加的表行上的效果
- 悬停函数不为每个条目动态工作
- 在鼠标悬停上动态创建的谷歌地图只有第一次才能正确显示
- 当鼠标悬停在孩子动态创建的地方时,防止onmouseout
- jQuery为什么动态添加的图像在悬停时不会显示/隐藏
- 在父元素的悬停出口动态实例化/暂停Youtube视频(iFrame API)
- 如何在Firebug中检查网页的动态悬停元素