Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation reload page on closer of shadowbox

    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.

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Go to shadowbox.js and find this part:
    Code:
     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.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    New Coder
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks a lot rangana, just what I needed. Works a treat.

  • #4
    Banned
    Join Date
    Aug 2007
    Posts
    39
    Thanks
    6
    Thanked 0 Times in 0 Posts
    are there any way you can do this without updating the core shadowbox js?

  • #5
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    I could'nt be of any certainty here, but try:
    Code:
    <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>
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •