Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript toastr(jquery)只能显示一次_Javascript_Jquery - Fatal编程技术网

Javascript toastr(jquery)只能显示一次

Javascript toastr(jquery)只能显示一次,javascript,jquery,Javascript,Jquery,你能帮我限制一下蟾蜍的外形吗。给定的情况是,当我登录系统时,主屏幕上只会出现一次welcome toastr,并且在我注销之前不会在整个会话中再次出现 这是我的密码 setTimeout(function() { toastr.options = { "closeButton": true, "debug": false, "progressBar": true,

你能帮我限制一下蟾蜍的外形吗。给定的情况是,当我登录系统时,主屏幕上只会出现一次welcome toastr,并且在我注销之前不会在整个会话中再次出现

这是我的密码

setTimeout(function() {
           toastr.options = {
              "closeButton": true,
              "debug": false,
              "progressBar": true,
              "positionClass": "toast-top-right",
              "onclick": null,
              "showDuration": "500",
              "hideDuration": "1000",
              "timeOut": "5000",
              "extendedTimeOut": "1000",
              "showEasing": "linear",
              "hideEasing": "linear",
              "showMethod": "fadeIn",
              "hideMethod": "fadeOut"
            };
            toastr.success("Welcome Admin", "Smartcomp Solutions Inc.");
        },1000);
在选项中使用
“防止重复”:true,


如果只想显示一次,请尝试以下操作:

toastr.options={
“closeButton”:false,
“调试”:错误,
“newestOnTop”:错误,
“progressBar”:错误,
“positionClass”:“右上角烤面包”,
“防止重复”:正确,
“onclick”:空,
“showDuration”:“300”,
“隐藏”:“1000”,
“超时”:“5000”,
“extendedTimeOut”:“1000”,
“挥杆”:“挥杆”,
“隐藏”:“线性”,
“showMethod”:“fadeIn”,
“隐藏法”:“淡出”
}
var标志=假;
setInterval(函数(){
如果(!标志){
flag=true;//将其存储起来以便以后比较
toastr.success(“欢迎管理员”、“Smartcomp解决方案公司”);
} },1000);


使用一些标志来检查它是否已设置。如果未设置,则保留它。@SuchitKumar我是jquery的新手,你能告诉我怎么做吗?试试张贴的答案……它不起作用,我想要的是只将toastr显示一次作为欢迎通知。如果只想显示一次,请使用
setTimeout
而不是
setInterval
,另一种方法是在
文档中调用toastr而不使用
setTimeout
setInterval
。ready
仍然不起作用,每次我重新加载页面时,它都会运行toastr,然后write是函数的一部分,只有在登录成功时才调用它,在这种情况下,您不需要做任何其他事情。