我的Fancybox有问题,我正在尝试检索一些php数据,但是没有正确地重新加载,我使用firebug来跟踪我页面上的活动,而且似乎实际上是从中检索正确的数据我的数据库,但Fancybox不解析该信息,它只显示第一个值。这是我的fancybox
$(document).ready(function() {
$(".various").fancybox({
fitToView : false,
width : '70%',
height : '70%',
autoSize : true,
closeClick : false,
scrolling : 'auto',
titlePosition : 'inside',
openEffect : 'fade',
closeEffect : 'fade',
type : 'inline'
}
});
});
这是我的一段PHP代码,我在检索$ value ['managementSummary']时遇到问题:
echo '<td><p class="various" href="#inline" title="Reference ID # ' . $referenceId . '">' .$value['managementSummary']. ' ...(+)';
echo '<div style="display: none;"><div id="inline" style="width:400px;height:200px;overflow:auto;"> '. $value['managementSummary'] .' </p></td></div>';
我知道我必须使用某种功能刷新我的内容,如:
beforeLoad : function() {
this.content = '. $value['managementSummary'] .';
当然它不起作用,任何想法???感谢!!!
答案 0 :(得分:0)
所以我能解决这个问题,我在我的fancybox调用中使用了这段代码:
afterLoad: function(){
this.content = $(this.element).attr('rel');
}
我也改变了我的PHP代码:
echo '<td><p>' .truncate($value['managementSummary']). ' <a href="#inline" class="various" rel="'. $value['managementSummary'] .'" title="Reference ID # ' . $referenceId . '">...(+)</a></p></td>';
echo '<div id="inline" style="width:400px;height:200px;display:none;"> '. $value['managementSummary'] .' </div></td>';
我的内容没有以正确的方式显示,这很奇怪,所以我使用了不同的div属性“Rel”来解析我的解决方案。