简体   繁体   中英

Facebox content is added multiple times

In the Facebox JavaScript plug-in, my content is adding multiple times.

Here is my code for initializing the Facebox code

$(document).ready(function(){
    $('a[rel*=facebox]').facebox();
}); 

Any idea why the content is generating multiple times?

here we go

$(document).bind('beforeReveal.facebox', function() {
  $("#facebox .content").empty();
});

My Problem is same, but after looking closely in debugger i found that facebox previous request can not stops and it get continues, like one click one request sending, 2nd click two request sending although first and second request Gives OK message, it means action performed successfully. However for every click previous request also get call like adding each request to a stack and and stack doesn't flush.

It's making facebox pop-up slower in log run (ie. When i am clicking multiple time. It's response time delayed.)

I know this is old however I have just resolved the exact same issue. Mine kept adding an additional GET call with each Facebox request so I resolved it by removing:

rel="facebox"

from the affected elements, added an ID to each one and called Facebox with:

$("#elementID").click(function(){
    $.facebox({ ajax: "my-facebox-file.html" });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM