Skip to main content

Image previews with custom script

Kate B.asked

When I upload image and insert it as a preview N1ED adds attribute rel="lightbox" to support beautiful opening of a preview in full screen mode. But I do not use LightBox, I use my own script and I need to set attribute data-img="preview".

Dmitriy Komarovanswered

By default Image Preview widget is added with adding rel="lightbox" to let it work with LightBox, ShadowBox and other scripts compatible with each other. If you want to use your own script, please modify template of your widget:

widgets.ImagePreview.templateLink = {
classes: [],
styles: {
"background-color": "white",
"margin": "3px",
"outline": "none"
},
attributes: {
"rel": "lightbox",
"data-img": "preview"
}

This configuration extends default widget parameters. Of course you can remove rel attribute if you do not need it anymore.

Solved