Refresh links on page

8 messages Options
Embed this post
Permalink
Vaskerville

Refresh links on page

Reply Threaded More More options
Print post
Permalink
After an update, I'm trying to refresh the links on the page so they can be available...

Shadowbox.clearCache();
Shadowbox.setup();

Isn't doing the trick. Both functions are firing. I have tried this with the 'correction' to the clearCache() function with no change in the results.

Has anybody been able to do this?
Wizzud

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
try this for clearCache()...

    Shadowbox.clearCache = function(){
        var i = cache.length;
        while(i--){
            if(cache[i].el){
                SL.removeEvent(cache[i].el, 'click', handleClick);
                try{
                  delete cache[i].el.shadowboxCacheKey;
                }catch(e){
                  if(cache[i].el.removeAttribute){
                    cache[i].el.removeAttribute('shadowboxCacheKey');
                  }
                }
            }
        }
        cache = [];
    };

Combine literacy with curiosity and a whole world of information opens up to you
Vaskerville

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
Thanks for this. I can confirm that the above does work...and even the original code works (at least in Safari 3).

What I've discovered, is that Jquery ($.post) returns my results to the page AFTER Shadowbox.setup(); is firing so it's logical that it's not refreshing all my links (it does refresh the ones not included in the ajax reload).

So...it's not Shadowbox afterall... :/

Great work...a 'tip' will arrive shortly...
Vaskerville

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
Well, for what it's worth...I just can not get this to work with a Jquery $.post call...but if like use the Jquery.load() method it works.

What I'm doing is a little complicated and there could be something else in the way...but I thought I would post this...maybe this makes some sense to somebody else...

In the end, I just designed a way around it so everything works...the first idea was too much...second idea works like a charm (still using Shadowbox too).
brentA

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Wizzud
Wizzud wrote:
try this for clearCache()...

    Shadowbox.clearCache = function(){
        var i = cache.length;
        while(i--){
            if(cache[i].el){
                SL.removeEvent(cache[i].el, 'click', handleClick);
                try{
                  delete cache[i].el.shadowboxCacheKey;
                }catch(e){
                  if(cache[i].el.removeAttribute){
                    cache[i].el.removeAttribute('shadowboxCacheKey');
                  }
                }
            }
        }
        cache = [];
    };
thank you thank you thank you, this worked like a charm! this little bug has been bothering me for weeks. what a relief!
User

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
In reply to this post by Wizzud
This patch fixes IE 7 for me.
Vasja

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
I had the same problem and fixed it with downloading source zip file and editing shadowbox.js. I changed the removeCache function to...

removeCache: function(link){
            S.lib.removeEvent(link, 'click', handleClick);
            S.cache[link[S.expando]] = null;
            try{
            delete link.shadowboxCacheKey;
                        }catch(e){
                if(link.removeAttribute){
                link.removeAttribute('shadowboxCacheKey');
                }
            }
        },
gomtuu

Re: Refresh links on page

Reply Threaded More More options
Print post
Permalink
hello,
i am an ajax newbie.
can anybody explain a little more specific how or better where (files?) to makes this work?
i am looking one week for a solution.
now i am knowing the problem (ajax refresh) but dont know to solve it.
thank you!