...

View Full Version : reload page on closer of shadowbox



rcouser
09-28-2008, 11:00 PM
Hello,
I'm not to sure where the best place is to post this but I need help with JavaScript to reload page on closer of shadowbox.
http://www.mjijackson.com/shadowbox/
The problem is I have a button that when clicked loads up shadowbox with form inside to add products. When the form is submit and shadowbox closes I have to reload the page manually for the entries to appear. Is there some sort of code that could reload the page automatically on closure of the shadowbox. I notice is the shadowbox.js the follow line onClose:null, and thought maybe it could be something to do with this but my JavaScript skills are minimal.
Thanks in Advance.

rangana
09-29-2008, 06:19 AM
Go to shadowbox.js and find this part:


Shadowbox.close = function(){
if(!activated) return; // already closed

// stop listening for keys
listenKeys(false);
// hide
toggleVisible(false);
// remove the content
if(content){
content.remove();
content = null;
}

// clear slideshow variables
if(typeof slide_timer == 'number') clearTimeout(slide_timer);
slide_timer = null;
slide_delay = 0;

// fire onClose handler
if(options.onClose && typeof options.onClose == 'function'){
options.onClose(gallery[current]);
}

activated = false;
location.reload();
};


Add highlighted.

rcouser
09-29-2008, 01:29 PM
Thanks a lot rangana, just what I needed. Works a treat.

I_Love_Privacy
10-16-2008, 09:37 AM
are there any way you can do this without updating the core shadowbox js?

rangana
10-16-2008, 11:04 AM
I could'nt be of any certainty here, but try:


<script type="text/javascript">
function closeSelf()
{
var close=document.getElementById('shadowbox_nav_close'); // ID of the "x" image?
close.onclick=function()
{
Shadowbox.close();
location.reload();
}
}
window.addEventListener?window.addEventListener('load',closeSelf,false):
window.attachEvent('onload',closeSelf);
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum