从链接中单击Fancybox关闭FancyBox

时间:2015-11-16 16:32:07

标签: jquery fancybox

好的我有一个html页面集。当我点击一个按钮时,它会显示另一个html页面,但在fancybox中。在那个页面中,我有多个链接。当我点击其中一个链接时,我希望它在普通页面上,而不是从fancybox中去那里

以下示例

第一个php页面

<?php
            session_start();
            require_once 'connect.php';
            ?>
            <html>

            <head>
                <!-- Add jQuery library -->
            <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>



            <!-- Add fancyBox -->
            <link rel="stylesheet" href="/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
            <script type="text/javascript" src="/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
             <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">

            <style type="text/css">


                                 html { 
                              background: url(images/main.jpg) no-repeat center center fixed; 
                              -webkit-background-size: cover;
                              -moz-background-size: cover;
                              -o-background-size: cover;
                              background-size: cover;
                            }


                          .container:before {
                              content: '';
                              position: absolute;
                              top: -8px;
                              height: auto;
                              right: -8px;
                              bottom: -8px;
                              left: -8px;
                              z-index: -1;
                              background: rgba(0, 0, 0, 0.08);
                              border-radius: 4px;

                            }

                              .dashboard {



                                    text-align: center;

                                    font-family: ‘Lucida Console’, Monaco, monospace;





                                   }



                                  .container {


                               clear: both;
                               margin-right: auto;
                            margin-left: auto;
                            position: relative;
                            bottom: 0px;
                            height: auto;
                          margin: 50px auto;
                          padding: 20px 50px 20px;
                          width: 700px;
                          background: transparent;
                          border-radius: 3px;
                          -webkit-box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
                          box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
                    }

                    .a {
                        text-decoration: none;


                    }




                    </style>

                </head>

                <body>
            <div class='container'>
                <div class='dashboard'>

            <div class='pure-button'><a class="fancybox fancybox.iframe" href="test1.php" target="_parent">Hospital Orders</a></div>
            <br>
            <div class='pure-button'><a class="fancybox fancybox.iframe" href="test2.php" target="_parent">Patient Orders</a></div>
            </div>
            </div>









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







                </body>

                </html>

这是Test1.php页面

<?php
                    session_start();
                    require_once "connect.php";
                    ?>
                    <html>

                    <head>
                          <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
                        <meta name="viewport" content="width=device-width, initial-scale=1.0">
                        <link rel="stylesheet" type="text/css" href="tablecss.css">
                        <style type="text/css">


                                         html { 
                                      background: url(images/main.jpg) no-repeat center center fixed; 
                                      -webkit-background-size: cover;
                                      -moz-background-size: cover;
                                      -o-background-size: cover;
                                      background-size: cover;
                                    }


                                  .container:before {
                                      content: '';
                                      position: absolute;
                                      top: -8px;
                                      height: auto;
                                      right: -8px;
                                      bottom: -8px;
                                      left: -8px;
                                      z-index: -1;
                                      background: rgba(0, 0, 0, 0.08);
                                      border-radius: 4px;

                                    }

                                      .dashboard {



                                            text-align: center;

                                            font-family: ‘Lucida Console’, Monaco, monospace;





                                           }



                                          .container {


                                       clear: both;
                                       margin-right: auto;
                                    margin-left: auto;
                                    position: relative;
                                    bottom: 0px;
                                    height: auto;
                                  margin: 50px auto;
                                  padding: 20px 50px 20px;
                                  width: 700px;
                                  background: transparent;
                                  border-radius: 3px;
                                  -webkit-box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
                                  box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
                            }




                            </style>
                    </head>












                    <body>
                    <div class="container">

                      <?php
                      include 'linksdb.php';
                      ?>

                        </div>

                        <br>

                        <div class='new'>

                            <form action="savepending.php" method='POST'>




                        </form>

                        </div>







                    </body>



                    </html>

正如您所看到的,当它打开test1.php时,它还会加载linksdb.php Insdie,有mnay链接。

 <?php


      $tech = $_SESSION['username'];



       //$query = mysqli_query($con, "SELECT * FROM newworders WHERE tech = '".$tech."'") or die(mysqli_error()); // get any actual error

      $query = mysqli_query($con, "SELECT * FROM newworders WHERE test = 'Yes' AND tech = '$tech'");




         echo "<table id='tb' border='1'>

                  <th>Test These</th>
                 <tr class='head'>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>time</th>
                    <th>space</th>
                    <th>noise</th>
                    <th>Complete</th>

                 </tr>";

      while($row = mysqli_fetch_array($query)) {

       echo "<tr>";




            echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['first'] . '</a><br />' . "</td>";

            echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['last'] . '</a><br />' . "</td>";

            echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['time'] . '</a><br />' . "</td>";

            echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['space'] . '</a><br />' . "</td>";

            echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['noise'] . '</a><br />' . "</td>";



            echo "<td>" . "<input type='checkbox' value='Yes' name='complete'" . '<br />' . "</td>";






    }





      ?>

现在,如果我点击linksdb.php中的任何链接,我希望它转到父页面上的链接。不在fancybox里面

1 个答案:

答案 0 :(得分:0)

我使用以下方法开始工作。

  echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '" target="_parent">' . $row['first'] . '</a><br />' . "</td>";

Target =“_ parent”非常适合我。