只是要清楚一点,$(“#details”)。html(data)加载“ a”标签对吗?
上一次我检查时,fancybox()要求该元素已经在DOM上存在。当$(document).ready触发时,$(“。hotel”)可能还不存在。您可以在$
.post之后移动fancybox设置,例如:
function post(){ $.post("lookup.php", {action: "find", area: area, stars: stars, amenities: amenities, state: $('#state').val()}, function(data) { $("#details").html(data); // bind fancy box $(".hotel").fancybox({ 'width' : '75%', 'height' : '75%', 'type' : 'iframe' }); });}您可能需要提防将fancybox调用到已经用fancybox调用的元素。那里可能会有一些并发症。



