I've installed FaceboxRender and JQuery and Facebox. Following the instrutions on http://github.com/ihower/facebox_render/
I've tried Facebox alone, in my rails app and it's working. After that I've put the folder facebox_render in vendor/plugins/facebox_render/, I added
include FaceboxRender
in /app/controllers/application.rb restarted my app, then wrote the link:
facebox_link_to "Whatever", :url => whatever_path
but not开发者_开发知识库hing happen when I click.
Any idea?
Thank you
Have you included the facebox javascripts and css files in the head of your html layout?
<%= javascript_include_tag('jquery', 'facebox') %>
<%= stylesheet_link_tag('facebox') %>
Failing that, are you getting any javascript errors showing up in firebug?
Yes I've included them:
<%= stylesheet_link_tag "application", "jquery-ui", "map", "facebox", "faceplant" %>
<%= javascript_include_tag 'jquery', 'jquery.validate', 'facebox', 'application' %>
and in application.js
jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox({ loading_image : 'loading.gif', close_image : 'closelabel.gif' }) })
when I click on:
facebox_link_to "test", :url => '/test/new'
this is what and Firebug's console reports:
$("a[rel*=facebox]").facebox is not a function anonymous(function()) applicat...262613317 (line 4) anonymous() jquery.j...260464452 (line 19) anonymous([function(), function(), function(), 2 more...], function(), Object name=F) jquery.j...260464452 (line 12) anonymous() jquery.j...260464452 (line 19) anonymous() jquery.j...260464452 (line 19) [Break on this error] close_image : 'closelabel.gif'\n applicat...262613317 (line 4)
Make sure that you didn't linked JS file multiple times in your layout.
精彩评论