Open floatbox before Pageload is finished

Page: 1

Author Post
vr00011
Guest
Hello,

If you click on a image before the pageload is complete, floabox fails to open and it behaves as a normal link. Is there any way to prevent this?
Administrator
Registered: Aug 2008
Posts: 3382
Floatbox does early code loading on dom-ready and does not wait for the full page load to complete with all graphics before initializing. There is no way possible to get the code loaded earlier. (It needs the dom loaded so it can find and "tag" the floatboxed anchors.)

In all my testing I've never been able to click on a link fast enough to catch it before floatbox has tagged it. If you've got an online example of where this can be done I'd love to take a look and see if I can find a reason for it.

Cheers...
vr00011
Guest
Actually I did it on the demo-page http://floatboxjs.com/demo.php

Hit F5 and click on a picture as soon as you see it. The picture is visible before the background graphics to the left is visible. I use IE7

However, I see this as a very little problem for a really great script. One solution is to use target="_blank" so that the picture opens in a new window when floatbox fails. Most users don't try to click on pictures that fast..
Administrator
Registered: Aug 2008
Posts: 3382
Yup, you're right. You can catch the link before floatbox is initialized. Fortunately, site visitors don't try as hard as testers to do this. :)

It occurs to me that there is a clean way to prevent premature clicking. If you put an event handler of onclick="return false;" on the floatboxed anchors they won't load as normal anchors. When floatbox gets around to tagging them, it replaces the onclick action with its own.

Slick eh?
vr00011
Guest
Great, thanks a lot!

Page: 1