javascript - 用js写了个tip弹窗,切换页面弹框不会消失?

查看:134
本文介绍了javascript - 用js写了个tip弹窗,切换页面弹框不会消失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

 /*
      * 提示框
      */
     window.showTip=function(msg){
         var tip='<div  class="dcxx"><span class="promptMsg">msg</span></div>';
         var $tip=$(tip).appendTo(window.top.document.body);
         $tip.stop(true);
         $tip.find('.promptMsg').html(msg);
         $tip.show();
         $tip.fadeIn(500).delay(2000).fadeOut(500);
         window.top.setTimeout(function(){
             $tip.remove();
         },3000);
     };

解决方案

window.top.setTimeout(function(){
    $tip.remove();
},3000);

你用的 frame 框架,window.top 中,没有 $tip。

这篇关于javascript - 用js写了个tip弹窗,切换页面弹框不会消失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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