ron*_*nni 0 jquery modal-dialog colorbox html-content-extraction
我的页面有很多div <a href>用于打开modalboxes(colorbox).这些链接打开的页面有一个id="mainColumn".只需从此ID加载内容.
<div>
<a href="includes/page_1.html" class="pop"></a>
</div>
<div>
<a href="includes/page_2.html" class="pop"></a>
</div>
<div>
<a href="includes/page_3.html" class="pop"></a>
</div>
$(".pop").colorbox({
href: $(".pop").attr('href') + " #mainColumn"
});
Run Code Online (Sandbox Code Playgroud)
在的人的href的<a>的变化进入第一个...
因此,将/ page_3.html更改为includes/page_1.html或换句话说:所有模态框都显示相同的内容...
$(this) 给我内容未定义
任何帮助都会感激,谢谢
在colorbox的选项中,您引用了第一个元素的$(".pop").attr('href')get href属性.你必须把它包装成方法的调用. .popeach
$(".pop").each(function() {
var el = $(this);
el.colorbox({
href: el.attr('href') + " #mainColumn"
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
134 次 |
| 最近记录: |