繁体   English   中英

LightBox 和 Leaflet 创建图片库

[英]LightBox and Leaflet to create an image gallery

我目前正在尝试实现一张地图,其中充满了生成的标记。 在标记的每个弹出框中都有一个图像,并且在单击时每个图像将显示在一个灯箱模式中。 有谁知道是否有可能将所有这些放在一起,因为目前我的图像打开了一个模态但没有链接到其他图像。

为了调试,我在同一页面中添加了图像,这些图像不在地图上,而且似乎工作正常。

关于我如何使(jquery 和传单(地图)似乎有问题)工作的任何帮助。

我使用 jquery UI 的对话框创建了类似于灯箱的东西

请参阅此线程: 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);

暂无
暂无

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

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