bpopup-ajax加载无法正常工作
我有以下代码,但这不起作用。我希望通过ajax调用加载本地html文件,但它没有按预期工作。它只显示“你好吗”,而它应该显示来自另一个html文件的内容 下面是下面的代码bpopup-ajax加载无法正常工作,bpopup,Bpopup,我有以下代码,但这不起作用。我希望通过ajax调用加载本地html文件,但它没有按预期工作。它只显示“你好吗”,而它应该显示来自另一个html文件的内容 下面是下面的代码 <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="../js/jquery-2.1.0.min.js"></scrip
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../js/jquery-2.1.0.min.js"></script>
<script src="http://dinbror.dk/bpopup/assets/jquery.bpopup-0.11.0.min.js"></script>
<style>
#element_to_pop_up {
background-color: #fff;
border-radius: 15px;
color: #000;
display: none;
padding: 20px;
min-width: 400px;
min-height: 180px;
}
.b-close {
cursor: pointer;
position: absolute;
right: 10px;
top: 5px;
}
</style>
</head>
<body>
...
<button id="my-button">POP IT UP</button>
<!-- Element to pop up -->
<div id="element_to_pop_up">
Hello. wow. How are you?
</div>
...
<script>
// Semicolon (;) to ensure closing of earlier scripting
// Encapsulation
// $ is assigned to jQuery
; (function ($) {
// DOM Ready
$(function () {
// Binding a click event
// From jQuery v.1.7.0 use .on() instead of .bind()
$('#my-button').bind('click', function (e) {
// Prevents the default action to be triggered.
e.preventDefault();
// Triggering bPopup when click event is fired
$('#element_to_pop_up').bPopup({
content: 'iframe', //'ajax', 'iframe' or 'image'
contentContainer: '.content',
loadUrl: '1.html'
});
});
});
})(jQuery);
</script>
</body>
</html>
#元素到弹出窗口{
背景色:#fff;
边界半径:15px;
颜色:#000;
显示:无;
填充:20px;
最小宽度:400px;
最小高度:180px;
}
.b-close{
光标:指针;
位置:绝对位置;
右:10px;
顶部:5px;
}
...
弹出来
你好哇!你好吗?
...
//分号(;)以确保关闭早期脚本
//封装
//$被分配给jQuery
; (函数($){
//DOM就绪
$(函数(){
//绑定单击事件
//在jQuery v.1.7.0中,使用.on()代替.bind()
$(“#我的按钮”).bind('click',函数(e){
//防止触发默认操作。
e、 预防默认值();
//触发click事件时触发bPopup
$(“#元素”到“弹出”).bPopup({
内容:“iframe”、“ajax”、“iframe”或“image”
contentContainer:“.content”,
loadUrl:'1.html'
});
});
});
})(jQuery);
您没有类名为“content”的容器。
这应该起作用:
<div id="element_to_pop_up" class="content">
Hello. wow. How are you?
</div>
你好哇!你好吗?