if (!$('#course-detail-modal').is(':visible')) { window.modalStack = []; } $('#course-detail-modal').modal('hide'); $('#course-detail-modal').remove(); window.modalStack.push({ 'title': 'CPH 681', 'url': '/zapps/CourseCatalog/CourseDetail/2020/030?CoursePrefix=CPH&CourseNumber=681&CourseSection=001' }); $('body').append('