Difference between revisions of "Team:TU Delft/Header Test"

Line 356: Line 356:
 
</script>
 
</script>
 
<script>
 
<script>
 +
function centerModal() {
 +
    $(this).css('display', 'block');
 +
    var $dialog = $(this).find(".modal-dialog");
 +
    var offset = ($(window).height() - $dialog.height()) / 2;
 +
    // Center modal vertically in window
 +
    $dialog.css("margin-top", offset);
 +
}
 +
 +
$('.modal').on('show.bs.modal', centerModal);
 +
$(window).on("resize", function () {
 +
    $('.modal:visible').each(centerModal);
 +
});
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 08:30, 29 July 2015