Last active
January 30, 2018 16:08
-
-
Save calevano/e2153a25aa642ff10a5f8dfb7bd3fc41 to your computer and use it in GitHub Desktop.
Create simple openModal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#In view | |
<a href="[_route_]" | |
class="btn btn btn-success btn-circle btn-xs zmdi zmdi-edit" | |
data-toggle='modal' | |
data-target="#openModal" | |
data-tamanio='lg'> | |
</a> | |
#OpenModal | |
$(document).on('click', '[data-target=#openModal]', function (e) { | |
e.preventDefault(); | |
var target = $(this).attr("href"); | |
var small = $(this).data('tamanio'); | |
var category = (typeof $(this).data('categoria') === "undefined") ? "" : $(this).data('categoria'); | |
if (target.indexOf('#') === 0) { | |
$(target).modal('open'); | |
} else { | |
$.get(target, function (data) { | |
$('<div class="modal fade mimodalpe ' + category + '" data-backdrop="static" data-keyboard="false"><div class="modal-dialog modal-darkorange modal-' + small + '"><div class="modal-content">' + data + '</div></div></div>').modal(); | |
}).success(function () { | |
}); | |
} | |
}); | |
#closeModal | |
$(document).on('click', '.btnDeleteModal', function () { | |
setTimeout(function () { | |
$('.mimodalpe').remove(); | |
}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment