您的问题不是那么具体。
是否每个人都要从不同的URL加载?
这可能是也可能不是你要找的答案:
$(document).ready(function() {
$('.my-button').bind('click', function(e) {//select all the buttons with a class selector
var loadFile = $(this).data("file");
// Prevents the default action to be triggered.
e.preventDefault();
// Triggering bPopup when click event is fired
$('#element_to_pop_up').bPopup({
contentContainer:'.content',
loadUrl: loadFile //Uses jQuery.load()
});
});
});
//你的HTML:
Load one modal
Load another modal
Load a third modal
我假设你的插件bpopup可以多次使用。我没有测试过它。
顺便说一句我不知道为什么你的脚本块发生在ID为'element_to_pop_up'的div内。它不需要是一个让代码更难阅读的代码。