简体   繁体   English

如果锚点在 Javascript 内,我无法打开灯箱

[英]I can't open a lightbox if the anchor is inside a Javascript

I have a problem.我有个问题。 I'm using the "Venobox" plugin, in order to use a modal window when the user wants to see the image on its original size.我正在使用“Venobox”插件,以便在用户想要查看原始尺寸的图像时使用模态 window。

In HTML (the common way) this works well, I can open images or html code:在 HTML(常用方式)这很好用,我可以打开图像或 html 代码:

<a class="venobox" data-type="iframe" href="acercade.php">

But when it comes about using this code on javascript (I'm using it with a Leaflet map), this no longer works.但是当涉及到在 javascript 上使用此代码时(我将它与 Leaflet 地图一起使用),这不再有效。

var liga = '<a class="venobox" href="' + enlace + '" target="_blank"><div class="imagen"><img src="' + enlace + '" width="450"></div>';

L.marker([object.get('Latitud'),object.get('Longitud') ], {icon: FaltaDeAguaIcon}).bindPopup(' <p><span class="grande"> ' + object.get('Tipo_Reporte') + ' </span></p><p>Fecha: ' + object.get('Fecha') + ' </p><p>Hora: ' + object.get('Hora') + liga + '<p>Comentarios:<br /> ' + noundefined(object.get('Comentario')) + '</p>').addTo(FaltadeAgua).addTo(todos);

What can I do if I want to open the image in the window with the anchor inside the Javascript?想用Javascript里面的anchor打开window里面的图片怎么办?

Thanks谢谢

I solved mine using this:我用这个解决了我的问题:

$('#div').append(
//html to append
//then add this:
                    new VenoBox({
                        selector: '.venobox',
                        titleattr: 'title',
                        titlePosition: 'bottom',
                        numeration: true,
                        infinigall: true,
                        share: true,
                        spinner: 'swing'
                    });
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM