custombox.js infinite modal issue

HTML

<link rel="stylesheet" href="http://dixso.github.io/custombox/dist/custombox.min.css">
<script src="https://github.com/dixso/custombox/blob/master/dist/custombox.min.js"></script>
<!-- Modal AJAX -->
<div class="modal-demo modal-ajax" style="display: block;">
    <button type="button" class="close" onclick="Custombox.close();">
        <span>&times;</span><span class="sr-only">Close</span>
    </button>
    <h4 class="title">
        Modal title
        <button type="button" class="btn btn-primary infinite">Open other modal</button>
    </h4>
    <div class="text">
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>
</div>

CSS

body {background-color:#CCC;}
.element {border:1px #FFF solid; width:300px; padding:10px; text-align:center;}
.element:hover {border:1px #F00 solid; cursor:pointer; color:#FFF}
#modal1 {display:none; background-color:#333; float:left; padding:40px;}
.close {color:#F00; width:50px; float:right;}
.close:hover {color:#000; cursor:pointer;}
#modal2 {display:none; background-color:#666; float:left; padding:40px;}

JavaScript

$(function () {
        $('.element').on('click', function ( e ) {
            Custombox.open({
                target: '.modal',
                effect: 'push',
                overlayColor: '#2C3E50',
            });
            e.preventDefault();
        });
    });

	$('.close').click(function(){
		Custombox.close();
	});