Jquery Facebox plugin doesn't work

2019-09-12 09:28发布

问题:

I downloaded facebox from famspam.com/facebox. Then I added facebox.js to be in public/javascripts folder, and facebox.css in public/stylesheets

Then I included this files in my application.html.erb AFTER original Jquery library ver 1.4

The last, I set a rel attribute to my a href tags to try to use Facebox, but it doesn't appear. When clicking on the link with rel="facebox", I just see a picture in my current browser tab.

Please, help me with facebox.

回答1:

Did you call facebox() onLoad?

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


回答2:

Also you need to set where is the images (close image and load image)

$(document).ready(function() {
$.facebox.settings.closeImage ='http://www.yoursite.com/functions/closelabel.png'
$.facebox.settings.loadingImage = 'http://www.yoursite.com/functions/loading.gif'
$('a[rel*=facebox]').facebox();   
});