guvenck
03-02-2007, 01:53 PM
Hello,
I am using GreyBox (http://orangoo.com/labs/GreyBox/) (which is a lightbox kind of popup window layer) on one of my sites.
On the site, somewhere I use Panels -sort of a Context Menu (div layers) that appear when
clicked on a link and give me options about the link.
Keep it simple, this is how I call a panel (There is some PHP involved
but ignore it):
<a id="panel$ID" href="#" onClick="return Panel($ID, $title);">$title</a>
and my JS function is as follows:
function Panel(id,title) {
if (PanelLoaded[id]) {
closePanel(id);
return false;
}
PanelLoaded[id] = true;
contBoxid = 'panel'+id;
var contBox = document.getElementById(contBoxid);
box = document.createElement('div');
box.className = 'contbox';
box.id = 'contbox'+id;
box.style.cursor = 'default';
box.style.position = 'absolute';
box.style.marginTop = '5px';
box.style.marginLeft = '10px';
box.style.padding = '5px';
box.style.width = '280px';
box.style.textAlign = 'left';
box.style.backgroundColor = '#003366';
box.style.border = 'solid 1px #000000';
box.style.MozBorderRadius = '7px';
box.innerHTML = ''+
'<table>'+
'<tr>'+
'<td>'+title+'</td>'+
'</tr>'+
'<tr>'+
'<td><a href="books.php?op=showbook&bid='+id+'"
onClick="closePanel('+id+');">Info</a></td>'+
'</tr>'+
'<tr>'+
'<td><a href="mylists.php?bid='+id+'" title="My Lists"
rel="gb_page_center[400, 300]" onClick="closePanel('+id+');">View
Lists</a></td>'+
'</tr>'+
'<tr>'+
'<td><a href="#" onClick="return closePanel(\''+id+'\')">Close</a></
td>'+
'</tr>'+
'</table>';
contBox.parentNode.appendChild(box);
return false;
}
function closePanel(id) {
boxid = 'contbox'+id;
document.getElementById(boxid).parentNode.removeChild(document.getElementById(boxid));
PanelLoaded[id] = false;
return false;
}
If you look at the Lists part - this is where call the GreyBox function with rel attribute.
If I load the page and click on the link, the Panel comes up and when
I click "View Lists", GreyBox does not come up, instead the browser
loads the page that GreyBox should have loaded.
So, how can I call the gb_page_center from this panel? I tried adding
parent, parent.parent, top.window before gb_page_center but it did not help.
Any help is highly appreciated.
I am using GreyBox (http://orangoo.com/labs/GreyBox/) (which is a lightbox kind of popup window layer) on one of my sites.
On the site, somewhere I use Panels -sort of a Context Menu (div layers) that appear when
clicked on a link and give me options about the link.
Keep it simple, this is how I call a panel (There is some PHP involved
but ignore it):
<a id="panel$ID" href="#" onClick="return Panel($ID, $title);">$title</a>
and my JS function is as follows:
function Panel(id,title) {
if (PanelLoaded[id]) {
closePanel(id);
return false;
}
PanelLoaded[id] = true;
contBoxid = 'panel'+id;
var contBox = document.getElementById(contBoxid);
box = document.createElement('div');
box.className = 'contbox';
box.id = 'contbox'+id;
box.style.cursor = 'default';
box.style.position = 'absolute';
box.style.marginTop = '5px';
box.style.marginLeft = '10px';
box.style.padding = '5px';
box.style.width = '280px';
box.style.textAlign = 'left';
box.style.backgroundColor = '#003366';
box.style.border = 'solid 1px #000000';
box.style.MozBorderRadius = '7px';
box.innerHTML = ''+
'<table>'+
'<tr>'+
'<td>'+title+'</td>'+
'</tr>'+
'<tr>'+
'<td><a href="books.php?op=showbook&bid='+id+'"
onClick="closePanel('+id+');">Info</a></td>'+
'</tr>'+
'<tr>'+
'<td><a href="mylists.php?bid='+id+'" title="My Lists"
rel="gb_page_center[400, 300]" onClick="closePanel('+id+');">View
Lists</a></td>'+
'</tr>'+
'<tr>'+
'<td><a href="#" onClick="return closePanel(\''+id+'\')">Close</a></
td>'+
'</tr>'+
'</table>';
contBox.parentNode.appendChild(box);
return false;
}
function closePanel(id) {
boxid = 'contbox'+id;
document.getElementById(boxid).parentNode.removeChild(document.getElementById(boxid));
PanelLoaded[id] = false;
return false;
}
If you look at the Lists part - this is where call the GreyBox function with rel attribute.
If I load the page and click on the link, the Panel comes up and when
I click "View Lists", GreyBox does not come up, instead the browser
loads the page that GreyBox should have loaded.
So, how can I call the gb_page_center from this panel? I tried adding
parent, parent.parent, top.window before gb_page_center but it did not help.
Any help is highly appreciated.