How to load a boot box into a user element with javascript methods attached?

I want to use cropping and resize images inside the boot window. For this I use Cropper .

Based on Cropper's examples , I have to create an instance of the trim object in my boot box when it is displayed, and get rid of it when it is closed.

Is this possible, or should I use regular bootstrap modal?

Can I, for example, add a tag scriptto the bootbox messageto do the work there? That would be dirty, and before I get into it, I wanted to check out cleaner / more elegant approaches.

+1
source share
1 answer

My template for using custom bootbox dialogs is the entry:

message: "<div id='dialogAnchor'></div>"

in the definition of the bootbox dialog box and follow it (after creating the boot box) with

Blaze.render(Template.myDialog,$("#dialogAnchor")[0])

to embed my template in the bootbox dialog directly. This greatly simplifies the management of the contents of the boot box. I did not use cropping, but assuming you can use it in a regular template, you can use the above template to get this template in the boot box.

+1
source

Source: https://habr.com/ru/post/1531883/


All Articles