简体   繁体   中英

Jquery Facebox plugin doesn't work

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.

Did you call facebox() onLoad?

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

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();   
});

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