bitbonsai / facyBox

A jQuery-based, Facebook/Fancybox-style lightbox which can display images, divs, or entire remote pages. Based on fancybox.net and famspam.com/facebox

Home Page:http://bitbonsai.com/facybox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamically loaded content problem

Terratuner opened this issue · comments

Dear developer,

My problem is as follow: I load content into a div on a page. The dynamically loaded content contains hlinks with the attr rel="facybox"
If i load the content regular via php it works fine, but when I load it dynamically with the .load() function the hlinks just open a regular new window and not the nice facybox ones.

My code is as follows:
$('a[rel*=facybox]').facybox();
$('#dynfrontpageres').load('someurl/request.ajax.php?action=requestfrontpageresume');

I've tried using the live() like this: $('a[rel*=facybox]').live().facybox(); but with no luck..

Hope you can help:-)

Loaded page contains:
a href="#" rel="facybox">some link</a

Page it is loaded into contains the:
$('a[rel*=facybox]').facybox();
$('#dynfrontpageres').load('someurl/request.ajax.php?action=requestfrontpageresume');

Don't know if I maybe am explaining myself in a poor way...

Hi

The thing is you'd have to load facybox one more time after loading the dyn content, or use the live jQ method to prevent this situation...

Running again after load:

function loadContent(arg) {
  $('#el').load('http://...', function(){
    // this will execute when new content is loaded
    $('a[rel = facybox]').facybox();
  })
}