简体   繁体   English

点击图片时如何弹出小窗口?

[英]How can I pop up small-sized window form when I click a photo?

<div class="featured-item">
                <img src="assets/images/preparing.jpg" alt=""  onclick="window.open('buy_form.html', '_blank');" />
                <h4>itemName</h4>
               
              </div>

I want to pop up a small window form(looks like a bill) but the code above show full-sized window not a small size.我想弹出一个小窗口表单(看起来像一张账单)但上面的代码显示的是全尺寸窗口而不是小尺寸。 I tried to put elements about height and width next to the '_blank', but it doesn't work.我试图在“_blank”旁边放置关于高度和宽度的元素,但它不起作用。

So I tried CSS,所以我尝试了 CSS,

body{
width: 400px;
height: 600px;

} }

But it just resize the content of popup form.但它只是调整弹出窗体的内容。

I want to show small window through modifying the first code.我想通过修改第一个代码来显示小窗口。 (Other ways are okay. I appreciate all helps for this question.) (其他方法都可以。我感谢对这个问题的所有帮助。)

window.open有一些参数:

window.open(buy_form.html,"NewWindow","width=420,height=290,status=yes,resizable=yes");

Just guessing but you might also want to know about popping up a lightbox or a modal dialog, overtop the other content.只是猜测,但您可能还想知道如何在其他内容之上弹出灯箱或模式对话框。

Here are examples that shows how.以下是说明如何操作的示例。

Easiest way to use a div as a modal dialog with jQuery 使用 div 作为带有 jQ​​uery 的模态对话框的最简单方法

Insert data into a modal dynamically动态插入数据到模态

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

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