fancybox没有显示点击

时间:2014-07-22 04:49:24

标签: jquery asp.net fancybox

以下是fancybox脚本的引用方式:

[母版页]

        <html xmlns="http://www.w3.org/1999/xhtml">
            <head id="Head1" runat="server">
                 <script type="text/javascript" src="Script/Jquery/jquery.js"></script>
                    <!-- Add jQuery library -->

                    <!-- Add fancyBox -->
                    <link rel="stylesheet" href="~/Script/fancybox/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
                    <script type="text/javascript" src="Script/fancybox/jquery.fancybox.pack.js?v=2.1.5"></script>

                    <link rel="stylesheet" href="~/Script/fancybox/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
                    <script type="text/javascript" src="Script/fancybox/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
                    <script type="text/javascript" src="Script/fancybox/helpers/jquery.fancybox-media.js?v=1.0.6"></script>

                    <link rel="stylesheet" href="~/Script/fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
                    <script type="text/javascript" src="Script/fancybox/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
            </head>
            <body>
        <form id="form1" runat="server">
          <table border="0" cellspacing="0" cellpadding="0" width="975px" align="center">
             <tr>
                <td>
                    <asp:ContentPlaceHolder ID="ContentPlaceHolderMiddle" runat="server">
                    </asp:ContentPlaceHolder>
                </td>
             </tr>
          </table>
        </form>
       </body>
    </html>

这里是aspx页面(使用母版页)

<asp:Content ID="Content5" ContentPlaceHolderID="ContentPlaceHolderMiddle" runat="Server">
 <script type="text/javascript">
        $(document).ready(function () {
            $(".fancybox").fancybox(
                {
                    'width': 1300,
                    'height': 1300,
                    'showCloseButton': true
                });
        });
    </script>
   <a class="fancybox" rel="fancybox-button" href="/Information/EmployeeInfo.aspx" >
        <img src="http://snag.gy/vRRIB.jpg" />test image</a>
</asp:Content>

问题是:每当点击锚点,而不是弹出一个花哨的盒子时,页面的网址就会改变(即它没有加载任何花哨的盒子)。如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

哦,我想通了:

旧代码:

 <a class="fancybox" rel="fancybox-button" href="/Information/EmployeeInfo.aspx" >
        <img src="http://snag.gy/vRRIB.jpg" />test image</a>

新代码:

 <a class="fancybox fancybox.iframe" rel="fancybox-button" href="/Information/EmployeeInfo.aspx" >
        <img src="http://snag.gy/vRRIB.jpg" />test image</a>

我添加了fancybox.iframe,但它确实有用..