【发布时间】:2012-03-22 08:01:02
【问题描述】:
我正在尝试在 Colorbox 中实现一个按钮,该按钮将更新模式并呈现表单。
Pinterest 的添加功能就是一个例子。 "Homepage > Add a Pin > Pin URL"
我尝试复制 Colorbox 的内联 HTML 示例。
<script type="text/javascript">
$(document).ready(function () {
$(".inline").colorbox({inline:true, width:"50%"});
$('a[rel="colorbox"]').live("click", function() {
$.colorbox({
open: true,
href: this.href
});
return false;
});
});
</script>
<div style='display:none'>
<div id='inline_content' style='padding:10px; background:#fff;'>
<p><strong>Add a Promotion</strong></p>
<p><a id="click" href="#" style='padding:5px; background:#ccc;'>Click me, it will be preserved!</a></p>
<p><strong>If you try to open a new ColorBox while it is already open, it will update itself with the new content.</strong></p>
<p>Updating Content Example:<br />
<a class="ajax" href="**shared/promotion_form**" rel="colorbox">Add a Promotion</a></p>
</div>
</div>
问题是表单是_promotion_form.html.erb,所以我无法链接到它。
【问题讨论】:
标签: javascript jquery render colorbox