简体   繁体   English

将CSS模态弹出窗口变成javascript函数以从后面的代码运行?

[英]Turning CSS modal popup into a javascript function to run from code behind?

I've searched the net for several weeks but because I just don't know enough javascript to work out how I can turn a CSS3 modal popup into JavaScript that can be loaded from code behind after a button_Click event. 我已经在网上搜索了几周,但是因为我不了解足够的JavaScript,无法弄清如何将CSS3模式弹出窗口转换为JavaScript,可以在button_Click事件之后从后面的代码中加载这些JavaScript。

The CSS3 is from https://www.script-tutorials.com/css3-modal-popups/ and I like the look, it resides in /styles/style1.css of the site. CSS3来自https://www.script-tutorials.com/css3-modal-popups/ ,我很喜欢它的外观,它位于站点的/styles/style1.css中。 The button_click event is in a repeater and after the data is returned I'd like the CSS3 popup to display. button_click事件在转发器中,返回数据后,我希望显示CSS3弹出窗口。 I'm not sure how to call a JavaScript function from the code behind. 我不确定如何从后面的代码中调用JavaScript函数。 How do I do it? 我该怎么做?

Not sure about the css into JavaScript but you can do the following. 不确定将CSS放入JavaScript中,但可以执行以下操作。 Attach a function to render this modal on the postback using the webforms JavaScript events. 附加一个函数,以使用webforms JavaScript事件在回发中呈现此模式。

Edit: check out this post Execute javascript after a partial postback of an updatepanel? 编辑:签出此帖子在部分更新回发updatepanel之后执行javascript吗?

I didn't check out you link but just make sure to serve the assets you need for the modal. 我没有签出您的链接,但只是确保提供模式所需的资产。

Edit/read it: this is a static demo. 编辑/阅读:这是一个静态演示。 You may need to inject some extra Dom elements before or after(using Js) the post back. 您可能需要在回发之前或之后(使用Js)注入一些额外的Dom元素。 Once the Dom elements and css are there your modal should be good. 一旦Dom元素和CSS出现,您的模态就应该很好。 Also if you can add the Dom elements for the modal when the repeater is running you don't need any JavaScript. 同样,如果可以在转发器运行时为模态添加Dom元素,则不需要任何JavaScript。

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

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