Hi
I don't understand what i'm doing wrong, I'm using Asp.Net 2005. This kind of code works ok:
<a href="foto.jpg" rel="floatbox">teste</a>
But if I try some javascript like this:
<input id="Button1" type="button" value="button" onclick="javascript: parent.fb.loadAnchor('foto.jpg','floatbox','Teste');return false;" />
or calling javascript functions like these:
<script type="text/javascript">
function open_wnd() {
parent.fb.loadAnchor("foto.jpg","floatbox","Teste");
return false;
}
// Demo From your site
function rsstick_onclick(href) { // headline onclick handler for floatbox
var rev = 'sameBox:true caption:Ola' +
'<a href="" onclick="fb.goBack(); return false;"><b>Return to headlines...</b></a>';
parent.fb.loadAnchor(href, rev);
return false;
};
</script>
My problem is thar floatbox appears OK, but when I close it if I have a page named Default.aspx, this page is opened (?). If I don't have this page, then I got a directory list of my project. Very weird
Close problem
Page: 1
Author | Post |
---|---|
quim
|
#1 Mon Oct 06, 2008 7:12 pm
|
Guest | |
#2 Mon Oct 06, 2008 9:22 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
Very weird indeed.
You don't happen to have the loadPageOnClose option set somewhere do you? Probably not. If you've got an online test page that I can check out I might be able to comb through it and help figure out what's happening. Failing that, I can't guess what's up from only the description. |
quim
|
#3 Tue Oct 07, 2008 3:55 pm
|
Guest |
Sorry, my page is not online.
Meanwhile I test this code with FireFox 2.0 and it works ok. The problem seems to be with IE 7. I create a new Asp.net project with a single page, all my code is here: <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default2.aspx.vb" Inherits="_Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <link rel="stylesheet" type="text/css" href="floatbox/floatbox.css" /> <script type="text/javascript" src="floatbox/framebox.js"></script> </head> <body > <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="javascript: parent.fb.loadAnchor('foto.jpg','floatbox','Teste');return false;" /> <input id="Button2" type="button" value="button" onclick="javascript: open_wnd();return false;" /> <a href="foto.jpg" rel="floatbox">teste</a> </div> </form> <script type="text/javascript"> function open_wnd() { parent.fb.loadAnchor("foto.jpg","floatbox","Teste"); return false; } </script> </body> </html> Basically i'm calling Floatbox in 3 different ways. However, this code works ok if my page name is "Default" if I name the page with a different name, than like I said before, when I close FloatBox I got a directory listing of my project (or Default.aspx page if it exists in my projet). The url to my page is: http://localhost:1468/Web_Teste/Default2.aspx After I close FloatBox the url change to: http://localhost:1468/Web_Teste/ This only happends with javascript calls, '<a href="foto.jpg" rel="floatbox">teste</a>' works ok all the time. I'm using Visual Studio 2005 with dotNet Framework 2.0 |
#4 Tue Oct 07, 2008 5:59 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
Your doctype declaration looks suspicious to me. That's a doc type to use if your pages are being served as type application/xhtml+xml. Firefox can run pages of this type, but IE can't and will use a type of text/html. Try an XHTML 1.0 doc type declaration, either strict or transitional.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" If the doctype change brings no joy, which of the 3 ways of closing floatbox generates the problem? Click the close button, click the overlay, press Esc. |
quim
|
#5 Tue Oct 07, 2008 10:32 pm
|
Guest |
Sorry, none of them worked.
However, before I make the changes I notice that this problem only happens when working with images. I test mpg, pdf, xml, html, aspx and they worked ok after closing, but if I try a jpg or png file, I got the problem. Both buttons don't work in my page. When I press ESC I got a javascript error: 'Childnodes' is null or not an object |
#6 Tue Oct 07, 2008 11:08 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
childNodes!!! Ah-hah!
An obscure bug in v3.12 that has been fixed in the pending next release. In floatbox.js, find: getThumb: function(anchor) { var nodes = anchor.childNodes, i = nodes.length; and change to: getThumb: function(anchor) { var nodes = anchor && anchor.childNodes, i = (nodes && nodes.length) || 0; My bet is satisfaction will follow. |
quim
|
#7 Wed Oct 08, 2008 4:34 pm
|
Guest |
Bingo!!
It works, but changing floatbox.js was not enought, I have to change framebox.js also. You are the man! Thanks a lot |
Page: 1