jonasundderwolf / django-image-cropping

Django helper application to easily and non-destructively crop arbitrarily large images in admin and frontend.
Other
552 stars 131 forks source link

delayed initialization of HTML elements for image cropping (such as in an AJAX scenario) #20

Closed ghost closed 4 years ago

ghost commented 11 years ago

I'm doing the image cropping in a jQuery dialog with the contents loaded via AJAX. So after opening the dialog, I'm calling image_cropping.init() in the .load() success handler to initialize the freshly-loaded elements. I realize that image_cropping.init() has already been called once when the page itself was first loaded, but this doesn't seem to be a problem (the only adverse effect is that it inserts a duplicate CSS entry for the size-warning in the HEAD block).

Still, I'm wondering if there's a more graceful way of using your image cropping app in cases such as this when delayed initialization is required. I'm not comfortable with the above approach because it could easily break if you release a new version of the app in which calling image_cropping.init() multiple times on the same page causes errors.

MRigal commented 4 years ago

Closing this issue as things have considerably evolved in the meanwhile. Feel free to reopen it if it somehow still impacts you, especially if you could give more details on what you want to achieve. Thanks for the initial report