KillGorack Posted April 20, 2019 Share Posted April 20, 2019 (edited) Working with some older php code, and Fancybox 2.1.5 We moved to getting js/css from CDNJS using: <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js" integrity="bla bla bla" crossorigin="anonymous"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css" integrity="bla bla bla" crossorigin="anonymous" /> Now the links within the fancy box, seems to be reloading the box again instead of following the link. I pretty sure it's a version issue, just cant get it to work.. <?php if(isset($pop)){ if($pop['shw'] == true){ //======================================================== // A message with a forward button ot two //======================================================== if($pop['typ'] == "MsgFwd"){ echo "<script type=\"text/javascript\">"; echo "$(document).ready(function() {"; echo "$(\"#show_pop_message\").fancybox().trigger('click');"; echo "});"; echo "</script>"; echo "<div id=\"show_pop_message\" style=\"display:none;\">"; echo "<div class=\"cont_login\">"; echo "<table cellpadding=\"2\" width=\"100%\" border=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td colspan=\"2\"><div class=\"text5\">".$pop['ttl']."</div></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><hr class=\"allform_div\"></td>"; echo "</tr>"; echo "<tr>"; echo "<td style=\"vertical-align: text-top;\"><img src=\"".$pop['ico']."\" style=\"margin-right:10px;\"></td>"; echo "<td><div class=\"text7\">".$pop['msg']."</div></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><hr class=\"allform_div\"></td>"; echo "</tr>"; echo "<tr>"; echo "<td><div class=\"text6\" style=\"text-align:left;\">".$pop['nte']."</div></td>"; echo "<td align=\"right\">"; echo "<a href=\"".$pop['fwda']."\" id=\"NULL\"><img src=\"".$pop['btna']."\" style=\"margin-bottom:-5px; text-align:right;\"></a>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</div>"; //======================================================== // Just a message (Ok and it goes away) //======================================================== }elseif($pop['typ'] == "MsgOk"){ echo "<script type=\"text/javascript\">"; echo "window.jQuery(document).ready(function() {"; echo "$.fancybox.open('#unlnkForm');"; echo "});"; echo "$(':button').click(function() {"; echo "parent.$.fancybox.close();"; echo "})"; echo "</script>"; echo "<div id=\"unlnkForm\" style=\"display:none;\">"; echo "<div class=\"cont_login\">"; echo "<table cellpadding=\"2\" width=\"100%\" border=\"0\" cellspacing=\"0\">"; echo "<tr>"; echo "<td colspan=\"2\"><div class=\"text5\">".$pop['ttl']."</div></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><hr class=\"allform_div\"></td>"; echo "</tr>"; echo "<tr>"; echo "<td><img src=\"".$pop['ico']."\" style=\"margin-right:10px;\"></td>"; echo "<td><div class=\"text7\">".$pop['msg']."</div></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"2\"><hr class=\"allform_div\"></td>"; echo "</tr>"; echo "<tr>"; echo "<td><div class=\"text6\" style=\"text-align:left;\">".$pop['nte']."</div></td>"; echo "<td align=\"right\">"; echo "<a href=\"javascript:parent.$.fancybox.close();\"><img src=\"".$pop['btna']."\" style=\"margin-bottom:-5px; text-align:right;\"></a>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</div>"; } //======================================================== } } ?> using that mess up there with: $pop = array( "shw" => true, "typ" => "MsgFwd", "ttl" => "Success!", "msg" => "Thanks your changes have been made, please press the OK button below.", "ico" => "sty/img/ico/alert.png", "nte" => "", "fwda" => $lnk, "btna" => "sty/img/btn/ok.png" ); Any ideas on how to get the links within the box to work? Edited April 20, 2019 by KillGorack Quote Link to comment https://forums.phpfreaks.com/topic/308615-fancybox-links-not-working/ Share on other sites More sharing options...
KillGorack Posted April 20, 2019 Author Share Posted April 20, 2019 I have a working solution, this seems to work.. From <script type="text/javascript"> $(document).ready(function() { $("#show_pop_message").fancybox().trigger('click'); }); </script> To <script type=\"text/javascript\"> window.jQuery(document).ready(function() { $.fancybox.open('#show_pop_message'); }); </script> Quote Link to comment https://forums.phpfreaks.com/topic/308615-fancybox-links-not-working/#findComment-1566216 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.