I am trying to load a simple model with THREE JS into an overlay via AJAX. The first load is working and the model is showing up, but as soon as I am closing the overlay and opening it again three js in not loading anymore.
Here is how I loaded the three js assets:
$.ajax({
url: url,
type: 'POST',
success: function(data) {
$('#modal-container').html(data);
$.getScript("https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js");
$.getScript("https://cdn.jsdelivr.net/gh/mrdoob/three.js@r92/examples/js/loaders/GLTFLoader.js");
$.getScript("assets/js/three-min.js");
}
});
Is there a better, more cleaner, way of achieving this? It also seems to slow down my whole pagespeed.