[英]How to put object into string?
When a used click an image, I want to put this clicked image into lightbox. 当使用过的点击图片时,我想将此点击图片放入灯箱中。 That's working.
很好 I would like to add another functionality and next to the displayed image in lightbox, I would like to put there a form yet.
我想添加另一种功能,并且在灯箱中显示的图像旁边,我想放置一个表单。
var aaa = $(this).addClass("some_class");
aaa.modal();
This is working well. 这运作良好。 The images is displayed in the lightbox correctly.
图像正确显示在灯箱中。
Further, 进一步,
var aaa = $(this).addClass("instagram_modal_active");
var modal_data = $('#show').html('<div class="modal"><div class="left">xx</div><div class="right">sfaf sf</div></div>');
modal_data.modal();
This is working correctly as well - in the lightbox window are displayed 2 columns with some text. 这也可以正常工作-在灯箱窗口中显示2列,并带有一些文本。
Now, I would like to put into the left column the clicked image: 现在,我想将单击的图像放入左列:
var aaa = $(this).addClass("instagram_modal_active");
var modal_data = $('#show').html('<div class="modal"><div class="left">'+aaa.html()+'</div><div class="right">sfaf sf</div></div>');
modal_data.modal();
or 要么
var modal_data = $('#show').html('<div class="modal"><div class="left">'+aaa+'</div><div class="right">sfaf sf</div></div>');
But in both cases the clicked image is not displayed inside the mini-layout of lightbox. 但是在两种情况下,点击的图像都不会显示在灯箱的迷你版面内。
Regarding to "error" messages - I am getting errors like [object Object]
or displaying the image outside the lightbox. 关于“错误”消息-我遇到类似
[object Object]
错误或在灯箱外部显示图像。
Could I ask you guys for advice on how to put the image with another text? 我可以问你们一些关于如何在图像上加上其他文字的建议吗?
Ok, so I fixed it this way: 好的,所以我用这种方法解决了:
var aaa = $(this).addClass("some_class");
var modal_data = $('#show').html('<div class="modal"><div class="left"></div><div class="right">sfaf sf</div></div>');
$('.left').html(aaa);
modal_data.modal();
Everything seems to be working. 一切似乎都正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.