jQuery Fancybox显示微小

时间:2011-12-14 17:16:58

标签: jquery fancybox

我完全不知所措。我把它减少到最简单的情况并通过W3c's validator运行它,我仍然得到这个小的Fancybox窗口。我多次使用过Fancybox。看起来像这样:

enter image description here

Page在这里:http://www.ericaspindler.com/private/

代码已经删除了所有其他JS和CSS,以便找到干扰。

整个文件:

<!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>Erica Spindler | Author</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<script src="http://code.jquery.com/jquery-latest.js"  type="text/javascript"></script>
<script type="text/javascript" src="../js/fancybox_new/jquery.fancybox-1.3.1.js"></script> 
<link rel="stylesheet" type="text/css" href="../js/fancybox_new/jquery.fancybox-1.3.1.css" media="screen" /> 

<script type="text/javascript">
  $(document).ready(function(){     
    $("#infolink").fancybox({});
     $("#infolink").click();
  });

</script>

</head>
<body>

<div id="fancy" style="display:none;">
<div style="width:500px; height:500px">
<img src="../g/video_Faulkner_Society_300.jpg" width="300" height="243" alt="" />
</div></div>
<a id="infolink" href="#fancy" class="infolink" style="display:none"></a>

</body>
</html>

为了澄清,#fancy div的原始HTML内容已缩减为这一张图片。

还删除了我初始化的参数:

  $(".infolink").fancybox({
    'scrolling'     : 'no',
    'titleShow'     : false,
    'overlayOpacity' : '0.7'
  });

有谁能告诉我我的错误?

2 个答案:

答案 0 :(得分:5)

display: none应设置在您想要充当框的 div上。请参阅#4 (inline content) in the documentation

所以将id="fancy"移动到这样的子div:

<div style="display:none;">
  <div style="width:500px; height:500px" id="fancy">

HERE 就是一个例子。

答案 1 :(得分:-1)

我不知道这是否会有所帮助,但是你的jQuery编写得不好。

$(document).ready(function(){     
  $("#infolink").fancybox();
});

让我知道这是否有帮助,如果不是,我会继续调查。