Floatbox not working in AJAX UpdatePanel

Page: 1

Author Post
Bryan8642
Guest
I have an ASPX page with an AJAX UpdatePanel. In the UpdatePanel I have a link that opens a site in a floatbox window.

Ex:
<a href='http://www.google.com' rel='floatbox'>link</a>

When I load the page, the floatbox window opens fine. However, once I update the AJAX UpdatePanel, the link no longer opens in a floatbox, but rather just redirects the browser.

Is there something special i need to enable floatbox in an updated UpdatePanel? I am using the latest build with the default options applied.

-Bryan
Administrator
Registered: Aug 2008
Posts: 3382
At page load time floatbox runs the tagAnchors function. This gathers an inventory of floatboxed enabled anchors and adds the onclick action to each of those anchors that causes them to open with the floatbox code. If content is subsequently added later, the anchors in that content have not been inventoried and do not have the floatbox onclick action assigned.

After updating a panel, you need to run the fb.tagAnchors function. See the paragraph describing the tagAnchors function in the programming active content section of the docs for details.

If you need to discard the previous floatbox inventory of items before re-tagging the new items, set fb.anchors.length = 0; just before you call tagAnchors.
Bryan8642
Guest
Thank you for your response. Adding the following after the update panel is refreshed resolved the issue.

//Clear the Floatbox anchors
fb.anchors.length = 0;
//Recreate the Floatbox anchors
fb.tagAnchors(document.getElementById('[div containing links]'));

Floatbox is great and I really appreciate how responsive you are!

-Bryan

Page: 1