From 9a6cc298dc8cf89237348ea17b994a3fc4d6dbb3 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Thu, 13 Oct 2016 19:19:03 +0200 Subject: [PATCH] Utility to load and fill the global #modal div --- src/scripts/tutti/00_utils.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/scripts/tutti/00_utils.js b/src/scripts/tutti/00_utils.js index 9cd4293..cb547f6 100644 --- a/src/scripts/tutti/00_utils.js +++ b/src/scripts/tutti/00_utils.js @@ -48,5 +48,20 @@ el.className = $.trim(classes.join(" ")); }); return this; + } + + $.fn.openModalUrl = function(title, url) { + this.on('click', function(e){ + e.preventDefault(); + + $('#modal').modal(); + $("#modal .modal-header span.title").html(title); + $("#modal .modal-body").load(url); + }); }; + }(jQuery)); + +$('#modal').on('hidden.bs.modal', function () { + $("#modal .modal-body").html(''); +});