用于创建图像库的LightBox和Leaflet

问题描述 投票:1回答:2

我目前正在尝试实施一个地图,其中包含所有生成的标记。标记的每个弹出框中都有一个图像,当单击时,每个图像都将以灯箱模式显示。有没有人知道是否可以将所有这些组合在一起,因为当我的图像打开一个模态但没有链接到其他图像时。

为了进行调试,我在同一页面上添加了图像,这些图像不在地图上,并且看起来可以正常工作。

关于如何使我工作的任何帮助(jquery和leaflet(maps)似乎有问题)。

javascript jquery google-maps lightbox leaflet
2个回答
0
投票
查看此线程:https://stackoverflow.com/a/24190496/3679978

JSFiddle:http://jsfiddle.net/8Lnt4/52/

//Creates the div element in jQuery var container = $('<div/>'); // Creates a variable holding html string to go in above container // Note I made the same image thats going to be enlarged into a smaller 120x90 thumbnail var tempimg = '<div id="dialog" style="display: none;"><img id="image" src=""/></div><div class="myImage"><img src="http://www.w3schools.com/images/pulpit.jpg" alt="myimage" width="120" height="90"/></div> Click to enlarge'; // Upon clicking the .myImage Class in the container (which is the thumbnail) Open a jQueryUI Dialog... container.on('click', '.myImage', function() { $('#dialog').dialog( //...which upon when it's opened... {open: function(){ ///... assign a variable that can acess the div id 'image'... imageTag = $('#image'); ///... and set the image src in #image (note that it'll be the fullsize this time)... imageTag.attr("src","http://www.w3schools.com/images/pulpit.jpg"); },closeOnEscape: true, modal:true}); }); container.html(tempimg);


0
投票
© www.soinside.com 2019 - 2024. All rights reserved.