0

我使用的是灰色盒子,它工作正常。但我尝试升级到fancybox,但它正在重定向到链接。任何人请帮助

这是我的代码:

  <script src="//code.jquery.com/jquery-1.8.0.min.js"></script>
 <script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.1.1"></script>
 <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css?v=2.1.1" media="screen" />
     <script type="text/javascript">
        var GB_ROOT_DIR = "greybox/";
    </script>
<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />

  <script>
   $(document).ready(function(){
      $("body").on("click",".fancybox",function() {
      link=($(this).attr('href'));
            $.fancybox({
            'width'                : '1000',
            'href'                 : link,
            'height'            : '750',
            'autoScale'         : false,
            'transitionIn'        : 'none',
            'transitionOut'        : 'none',
            'type'                : 'iframe'
            }); 
       event.preventDefault();
           });
 });
</script>  
</head>
<body>
<a class="fancybox" href="detail.php">Detail</a>
</body>
</html>

有什么我需要添加的吗?

4

1 回答 1

1

可能是灰色框与花式框冲突。删除灰盒脚本并尝试。它会起作用的

<script src="//code.jquery.com/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.1.1"></script>
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css?v=2.1.1" media="screen" />

<!--
<script type="text/javascript">
   var GB_ROOT_DIR = "greybox/";
</script>

<script type="text/javascript" src="greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/gb_scripts.js"></script>
<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
-->
于 2014-04-21T11:03:54.313 回答