Answer the question
In order to leave comments, you need to log in
How to load content from a separate file into a modal window using the bPopup plugin?
Good day, colleagues! Maybe someone had experience with the bPopup plugin ? I read the documentation and, it seems, did everything according to the examples, but the required result is not achieved. It is necessary that content from another page (test.html) is loaded into the popup window.
<head>
<link href="css/modal-windows.css" rel="stylesheet" type="text/css">
<button id="my-button">POP IT UP</button>
<!-- Element to pop up -->
<div id="element_to_pop_up">
<a class="b-close">x<a/>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.bpopup-0.11.0.min.js"></script>
<script>
;(function($) {
$(function() {
$('#my-button').bind('click', function(e) {
e.preventDefault();
$('#element_to_pop_up').bPopup({
contentContainer:'.content',
loadUrl: 'test.html' //Uses jQuery.load()
});
});
});
})(jQuery);
</script>
</body>
#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;
}
<div class="content">
<h2>Ajax popup</h2>
<p>
Content loaded with Ajax in bPopup
</p>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question