加入社区网站时如何显示提醒对话框? [英] How to show alert dialog when joining community site?

查看:63
本文介绍了加入社区网站时如何显示提醒对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户加入社区网站时,我想在对话框中显示我的提醒页面(/_layouts/15/MySubs.aspx)?是否可以使用客户端代码(最好是JQUERY)来执行此操作?怎么样?

When a user join a community site, I want to show My alerts page (/_layouts/15/MySubs.aspx) in a dialog? Is it possible to do this using Client Side Code (preferably JQUERY)? How?

注意:当用户尝试在社区网站中提供内容或单击"加入社区"按钮时,将显示"加入社区"对话框。我需要在对话框中显示我的提醒页面。

Note: Join community Dialog appears when a user is trying to contribute something in a Community site or clicking the Join Community button. I need the My alerts page appear in a dialog.

提前致谢

推荐答案

我们可以使用SP.UI.ModalDialog.showModalDialog在对话框中显示页面。

We can using SP.UI.ModalDialog.showModalDialog to show page in a dialog.

以下代码供您参考。

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
var clickBtn=false;
var myVar;


(function(){
(function(){


(" input [value ='Join this community']") .click(function(){
clickBtn = true;
});
myVar = setInterval(showAlertPage,100);
});
函数showAlertPage(){
if(clickBtn){
AlertDialog();
clearInterval(myVar);
}
}
函数AlertDialog(){
var options = {
url:" / _ layouts / 15 / MySubs.aspx",
title :"MyTest",
autoSize:false,
宽度:450,
高度:350,
showClose:true,
dialogReturnValueCallback:DialogCallback
}
SP.SOD.execute('sp.ui.dialog.js','SP.UI.ModalDialog.showModalDialog',options);
}
函数DialogCallback(结果,值){
if(result === SP.UI.DialogResult.OK){
//window.location.href=window。 location.href;
}
}
< / script>
("input[value='Join this community']").click(function(){ clickBtn=true; }); myVar = setInterval(showAlertPage, 100); }); function showAlertPage(){ if(clickBtn){ AlertDialog(); clearInterval(myVar); } } function AlertDialog(){ var options = { url:"/_layouts/15/MySubs.aspx", title: "MyTest", autoSize: false, width: 450, height: 350, showClose: true, dialogReturnValueCallback: DialogCallback } SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); } function DialogCallback(result, value) { if(result === SP.UI.DialogResult.OK) { //window.location.href=window.location.href; } } </script>

最好的问候,

Dennis


这篇关于加入社区网站时如何显示提醒对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆