Jquery 2个fancybox链接到不同的框-冲突
我有两个链接链接到Ruby on Rails上的FancyBox: 链接1的课程是:“为什么我在这里?” 链接2的类是:“反馈\链接fancybox” 当我第一次点击链接1时,我会进入链接2的fancybox。如果我再次单击,它会将我带到正确的链接。另一个按钮(链接2)工作正常 与其用各种可能/可能不相关的代码入侵您,不如告诉我您需要什么进一步的信息,我会提供 下面是为什么在这里(链接1)的呈现HTML: 以下是每个链接的HTML: 链接1:Jquery 2个fancybox链接到不同的框-冲突,jquery,ruby-on-rails,fancybox,Jquery,Ruby On Rails,Fancybox,我有两个链接链接到Ruby on Rails上的FancyBox: 链接1的课程是:“为什么我在这里?” 链接2的类是:“反馈\链接fancybox” 当我第一次点击链接1时,我会进入链接2的fancybox。如果我再次单击,它会将我带到正确的链接。另一个按钮(链接2)工作正常 与其用各种可能/可能不相关的代码入侵您,不如告诉我您需要什么进一步的信息,我会提供 下面是为什么在这里(链接1)的呈现HTML: 以下是每个链接的HTML: 链接1: <div id = "why_am_i_her
<div id = "why_am_i_here_container">
<%= link_to "Here\'s how it works", info_path(:welcome => params[:welcome]), :remote => true, :class => "why_am_i_here_button fancybox rounded-corner", :id => "why_am_i_here" %></div>
<div id = "why_am_i_here_container">
<%= link_to "Here\'s how it works", info_path(:welcome => params[:welcome]), :remote => true, :class => "why_am_i_here_button rounded-corner", :id => "why_am_i_here" %>
</div>
参数[:欢迎],:remote=>true,:class=>“为什么在这里”\u按钮fancybox圆角“,:id=>“为什么在这里”%>
链接2:
<li class = "app_header_item"><%= link_to 'Feedback (please)', new_feedback_path, :remote => true, :class => "feedback_link fancybox", :id => "feedback_link" %></li>
true,:class=>“feedback\u link fancybox”,:id=>“feedback\u link”%>
很难跟踪您在做什么,来回移动代码,但我要做的是:
链接1:
<div id = "why_am_i_here_container">
<%= link_to "Here\'s how it works", info_path(:welcome => params[:welcome]), :remote => true, :class => "why_am_i_here_button fancybox rounded-corner", :id => "why_am_i_here" %></div>
<div id = "why_am_i_here_container">
<%= link_to "Here\'s how it works", info_path(:welcome => params[:welcome]), :remote => true, :class => "why_am_i_here_button rounded-corner", :id => "why_am_i_here" %>
</div>
两个init都在相同的$(function(){})
ready方法中。上面的代码应该可以工作
我不确定您使用的是什么
.eq(0)。单击()代码>但现在删除它并测试链接。真正重要的是呈现的html以及用于初始化的jQuery代码fancybox@JFK:完成!很期待。我没有看到任何html代码,只有jQuery。。。呈现的html有点像实际上已经尝试过了-但是发生的是:我可以点击链接1并获得正确的链接;但不能点击链接2;如果我先点击链接2,则反之亦然。同时从class=>
中删除fancybox
,非常感谢您迄今为止的帮助。这些解决方案都不起作用。有效的方法是将函数转移到我的资产文件夹中,但现在我无法呈现“餐厅/搜索框”,因为资产中不支持该功能。因此,我正在寻找一种解决方法,从assets文件夹调用fancybox侦听器,但也允许渲染。
<li class = "app_header_item"><%= link_to 'Feedback (please)', new_feedback_path, :remote => true, :class => "feedback_link", :id => "feedback_link" %></li>
$(function () {
var search_value;
$(".why_am_i_here_button").fancybox({
// options for why_am_i_here_button
type: "iframe" // etc
});
$(".feedback_link").fancybox({
// options for feedback_link
type: "iframe" // etc
});
}); // ready