Close the SuperBox! "window" with text link

Create issue
Issue #24 invalid
osirisjacko created an issue

Sorry, it's not a bug but it's something thats bugging me!

I have no problems with anything, however what I am trying to achieve is I would like to have a text link within either the IFRAME mode or the Content mode to close down the "model". I know there is a "Close" or "Close Window" at the top bar to the right of the "model window", however I would really like to be able to add another link (a text link) beneath the text that would be made accessable when the user clicks to open the "model window".

Does anyone have any idea on how to close the SuperBox! model window using a text link <a href>Close Window</a> ???

I thank you all in advance for any solution and help!

Comments (26)

  1. osirisjacko reporter

    Hi, thanks for that, but could you please give me an example on how to implement this?

    I have a link such as the following and I am not sure how to implement it with the link to close the window:

    <a href="admin_logout.php" id="advlink" class="advlink" target="_parent">Yes, Logout</a> &nbsp; <a href="javascript: $.superbox.close()" id="advlink" class="advlink">No</a>

    I would be very greatful once more if you could assist.

    Kindest regards,

    J

  2. osirisjacko reporter
    • changed status to open

    Sorry Pierre, would you or someone mind help me to implement your solution into the link such as the above example??

    Many thanks, J

  3. osirisjacko reporter
    • changed status to open

    Error Code:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.3; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.1; .NET CLR 3.0.30729) Timestamp: Mon, 9 Nov 2009 17:23:02 UTC

    Message: Object doesn't support this property or method Line: 1 Char: 2 Code: 0 URI: https://www.falconfabrication.co.uk/_admincentre/confirm_logout.php

    Here is the page source:

    <?php
    	session_start();
    	include("admin_config.php");
    	include("admin_login.php");
    
    	if(isset($_COOKIE['cookadmname']) && isset($_COOKIE['cookadmpass'])){
    		setcookie("cookadmname", "", time()-60*60*24*100, "/");
    		setcookie("cookadmpass", "", time()-60*60*24*100, "/");
    	}
    
    	$today = date("D M d Y");
    	$year = date("Y");
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <HTML lang="en">
    <HEAD>
    	<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    	<title>Administration Centre &bull; Falcon Fabrication</title>
    	<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    	<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    	<META name="robots" content="noindex,nofollow">
    	<META name="robots" content="none">
    	<META http-equiv="imagetoolbar" content="no">
    	<META name="copyright" content="<?php print "$year"; ?> - Falcon Fabrication - falconfabrication.co.uk">
    	<LINK rel="stylesheet" type="text/css" title="default" href="_include/falconfabrication.css">
    	<script type="text/javascript" src="_include/falconfabrication.js"></script>
    	<script type="text/javascript" src="_include/jquery-1.3.2.js"></script>
    	<script type="text/javascript">
    	function closeBox() {
    		$.superbox.close();
    	}
    	</script>
    </HEAD>
    <BODY>
    <div id="containsite">
    	<div id="windowscreen">
    		<table class="screen">
    			<tr valign="top">
    				<td align="center">
    					<strong>Are you sure you want to logout?</strong>
    					<p>
    					<a href="admin_logout.php" id="advlink" class="advlink" target="_parent">YES</a> &nbsp; <a href="javascript: 
    
    $.superbox.close()" id="advlink" class="advlink">No</a>
    					<p>
    				</td>
    			</tr>
    		</table>
    	</div>
    </div>
    </BODY>
    </HTML>
    

    -----------------

    any help on this would great!!!

    thanks

  4. Pierre Bertet repo owner

    If you're in an iframe, you need to call $.superbox.close() on the parent window.

    window.parent.$.superbox.close()
    
  5. osirisjacko reporter
    • changed status to open

    The "Confirm Logout" window is opened via the SuperBox iframe such as:

    <a href="confirm_logout.php" rel="superbox[iframe][400x150]" class="white">Logout</a>
    

    I have changed the code to include your "window.parent.$.superbox.close() - here is the full page code again, still not closing the box:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <HTML lang="en">
    <HEAD>
    	<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    	<title>Administration Centre &bull; Falcon Fabrication</title>
    	<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    	<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    	<META name="robots" content="noindex,nofollow">
    	<META name="robots" content="none">
    	<META http-equiv="imagetoolbar" content="no">
    	<LINK rel="stylesheet" type="text/css" title="default" href="_include/falconfabrication.css">
    	<LINK rel="stylesheet" type="text/css" title="default" href="_superbox/jquery.superbox.css">
    	<script type="text/javascript" src="_include/falconfabrication.js"></script>
    	<style type="text/css">
    		#superbox-overlay{background:#e0e4cc;}
    		#superbox-container .loading{width:32px;height:32px;margin:0 auto;text-indent:-9999px;background:url('_superbox/loader.gif') no-repeat 0 0;}
    		#superbox .close a{float:right;padding:0 5px;line-height:20px;background:#333;cursor:pointer;text-decoration: none;border-bottom: 0px;}
    		#superbox .close a span{color:#fff;text-decoration: none;border-bottom: 0px;}
    		#superbox .nextprev a{float:left;margin-right:5px;padding:0 5px;line-height:20px;background:#333;cursor:pointer;color:#fff;}
    		#superbox .nextprev .disabled{background:#ccc;cursor:default;}
    	</style>
    	<script type="text/javascript" src="_superbox/jquery-1.3.2.js"></script>
    	<script type="text/javascript" src="_superbox/jquery.superbox.js"></script>
    	<script type="text/javascript" src="_superbox/jquery.superbox-min.js"></script>
    	<script type="text/javascript">
    		$(function(){
    			$.superbox.settings = {
    				closeTxt: "Close Control Panel",
    				loadTxt: "Loading Control Panel",
    				nextTxt: "Next",
    				prevTxt: "Previous"
    			};
    			$.superbox();
    		});
    	</script>
    	<script type="text/javascript" src="_include/jquery.js"></script>
    	<script type="text/javascript">
    	function closeBox() {
    		window.parent.$.superbox.close();
    	}
    	</script>
    </HEAD>
    <BODY>
    <div id="containsite">
    	<div id="windowscreen">
    		<table class="screen">
    			<tr valign="top">
    				<td align="center">
    					<strong>Are you sure you want to logout?</strong>
    					<p>
    					<a href="admin_logout.php" id="advlink" class="advlink" target="_parent">YES</a> &nbsp; <a href="javascript: closeBox();" id="advlink" class="advlink">No</a>
    					<p>
    				</td>
    			</tr>
    		</table>
    	</div>
    </div>
    </BODY>
    </HTML>
    

    I get this error when I click on the "No" link which has the call to the close function:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6.3; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; InfoPath.1; .NET CLR 3.0.30729) Timestamp: Tue, 10 Nov 2009 12:17:40 UTC

    Message: Object doesn't support this property or method Line: 41 Char: 3 Code: 0 URI: https://www.falconfabrication.co.uk/_admincentre/confirm_logout.php

  6. Pierre Bertet repo owner

    Sorry, but I do not understand what you want to do.

    You only need to include SuperBox! (styles and script) in the parent page, not in the page which is loaded in the iframe.

    Could you give me an URL with your code ?

  7. osirisjacko reporter

    I have the parent page - which has a link to the "Confirm Logout" window (click on the "LOGOUT" link at the top right hand side of the parent page) which is opened with the SuperBox iframe window. Within the "Confirm Logout" window I have a 2 links - one saying "YES" - which then directs to logout of the admin panel. The second link saying "NO". When they click on "NO" i just want the SuperBox iframe window to close down.

    The page this is on is password protected but nothing in it is functional since its something I am going to be working on for a long time as the new design for the public-site is a long way off. I have taken down the password so you can access it. The only user/pass you need is for the inline authentication - I have made a user/pass for you which is - Username: Pierre and Password: bertet (both case sensitive).

    URL: https://www.falconfabrication.co.uk/_admincentre/index.php

    Hope my issue makes sense now. Thanks for the help you are giving me so far!!

  8. Pierre Bertet repo owner

    I think the iframe can not access to window.parent object because of HTTPS mode (security). Could you try the same thing with AJAX mode ?

  9. osirisjacko reporter

    Yes I will try the confirm logout SuperBox with the AJAX method and see what happens.

    Is my code however for the "NO" link calling the correct function? and should work?

  10. Pierre Bertet repo owner

    In AJAX mode, you only need to call $.superbox.close() because you are on the same page.

  11. osirisjacko reporter

    so if i do:

    <a href="javascript: $.superbox.close()" id="advlink" class="advlink">NO</a> ????

  12. osirisjacko reporter

    just tried my above post with no luck - i've also removed the https: and still no lucl :-(

  13. Pierre Bertet repo owner

    As I've said you in comment 2, you must use the development version.

    The version you are using (0.9.1) does not implement the $.superbox.close() method.

  14. osirisjacko reporter

    GOT IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :-) YESS!!!

    	<script type="text/javascript">
    	function closeBox() {
    		$("P.close A").click();
    	}
    	</script>
    
                    <a href="javascript: closeBox();" id="advlink" class="advlink">NO</a>
    
  15. osirisjacko reporter

    ah right sorry i didnt understand wat you wanted me to do there - if I download that version I take it the $.superbox.close() will work??

    with the version I am using I got the solution from a previous thread by someone else as you can see in my post I just put up

    thanks!! i'll download the newest as you suggested and try the $.superbox.close() method as well!!

    thank you Pierre!! Your work is absolutely amazing by the way!!

  16. Former user Account Deleted

    This works for me. Cheers!

    window.parent.jQuery.superbox.close();
    

    or

    window.parent.$.superbox.close();
    

    Craig Myles

  17. Former user Account Deleted

    I do not this works:

    <script type="text/javascript"> function closeBox() { window.parent.$.superbox.close(); } </script>

  18. Former user Account Deleted

    Waaw Thanks a lot window.parent.$.superbox.close(); works for me after download the new version (But why you don't put this link on your website?)

    Cheers!

  19. Former user Account Deleted

    Ninguna de sus soluciones funcionaron!!, pero lo pude solucionar a mi manera, les cuento y espero que les sirva: 1) Modifique el archivo jquery.superbox.js , y agregue lo siguiente: ... $closeBtn = $('<p class="close"><a name="cerrame" id="cerrame" ><strong ... Yo agregue la propiedad id y name al link 2) Luego agregue esta funcion a la ventana padre: function closeBox() { jQuery(function($){ $("#cerrame").click(); }); } 3) En el iframe hijo en javascript realizo la siguiente llamad window.parent.closeBox(); ------------------------------- Esto me funciono, espero que les sea de utilidad! Saludos!

  20. Log in to comment