if (!$('#course-detail-modal').is(':visible')) { window.modalStack = []; } $('#course-detail-modal').modal('hide'); $('#course-detail-modal').remove(); window.modalStack.push({ 'title': 'HJS 328', 'url': '/zapps/CourseCatalog/CourseDetail/2022/010?CoursePrefix=HJS&CourseNumber=328' }); $('body').append('