[英]ajax popup center in body load from another page
i want to load popup in body center how to do it.. here is my all codes.. plzz help me for it.. thanks... 我想在身体中心加载弹出窗口怎么做..这是我的所有代码..请帮助我..谢谢...
head style 头型
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="http://dinbror.dk/bpopup/assets/jquery.bpopup-0.11.0.min.js"></script>
<script src="http://dinbror.dk/bpopup/assets/scripting.min.js"></script>
Jquery jQuery的
<script>
jQuery(function ($) {
$('.button').on('click', function () {
var id = $(this).data('id');
$.ajax({
url: '/shopping/ajax.php',
data: {
id: id
},
method: 'POST',
success: function (html) {
$('body').append(html);
$(html).bPopup();
},
error: function (returnValue) {}
});
});
});
</script>
Button html 按钮html
<button type="button" class="button small pop1" data-id="1521" >Add to Cart</button>
if you mean somthing like this after success you input in html and cheng css set 如果您的意思是成功后这样的事情,请输入html和cheng css set
success: function (html) {
$('#popup').append(html);
$('#popup').css('display','block');
$(html).bPopup();
},
http://fiddle.jshell.net/uzwL48k2/ http://fiddle.jshell.net/uzwL48k2/
css margin : 0px auto
is missing to your div with id #popup
CSS margin : 0px auto
ID为#popup
div缺少margin : 0px auto
Apply this css 应用此CSS
#popup {margin: 0px auto;}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.