toastr用法及修改提示框居中显示
web jQuery 2020-12-29 2894 0
关于本站

“最难不过坚持”

本人承接扒站仿站,php网站维护,病毒查杀,网站编辑,网站改版,html制作

有需要网站维护,改版,病毒查杀,网站编辑,网站备案,html制作等相关的工作可以联系我。
本人有多年相关工作经验,也可提供免费咨询,交个朋友。
有需要探讨问题的朋友,也可以加我微信,共同探讨!
微信:15011482830 QQ:408917339

6458439 2613 39
最新评论
https://jueru.net/
评 留言
:weixiao:
评 留言
:shuijiao: :weiqu: :zhenbang: :leng:
评 留言
:yiwen: :yiwen: :yiwen: :yiwen:
评 EasySass: could not generate CSS file. See Output panel for details.
这个业务逻辑多少都有点奇怪了,阅读浏览次数增值在新闻详情页的控制器方法里setInc,这怎么还写进模型事件里了。如果非要用onAfterRead也可以,把新闻文章的内容单独分出来一个news_content表,然后把它和news做关联,然后给news_content表的onAfterRead事件做增值处理,这样点进新闻页内查询到文章内容时才会触发它。
评 TP6模型事件-查询后onAfterRead不好用
文章标签更多
ThinkPHP (254)
Mysql (58)
DedeCms (33)
jQuery (67)
证件照 (1)
setInc (4)
setDec (4)
onclick (5)
打开边栏(ESC) 关闭边栏(ESC)
toastr是一个基于Jquery简单、漂亮的消息提示插件,使用简单、方便,可以根据设置的超时时间自动消失。

1、使用很简单,首选引入toastr的js、css文件

<script src="<%=path%>/res/toastr/toastr.min.js"></script>
<link rel="stylesheet" href="<%=path%>/res/toastr/toastr.min.css">
2、集成使用
//常规消息提示,默认背景为浅蓝色  
toastr.info("你有新消息了!");   

//成功消息提示,默认背景为浅绿色
toastr.success("你有新消息了!");  

//警告消息提示,默认背景为橘黄色
toastr.warning("你有新消息了!");    

//错误消息提示,默认背景为浅红色
toastr.error("你有新消息了!");   

//带标题的消息框
toastr.success("你有新消息了!","消息提示");  
//另一种调用方法
toastr["info"]("你有新消息了!","消息提示") 
3、自定义用法
通过设置自定义参数,可达到不同的效果
<script type="text/javascript">
toastr.options = { 
    "closeButton": false, //是否显示关闭按钮
    "debug": false, //是否使用debug模式
    "positionClass": "toast-center-center",//弹出窗的位置
    "showDuration": "300",//显示的动画时间
    "hideDuration": "1000",//消失的动画时间
    "timeOut": "5000", //展现时间
    "extendedTimeOut": "1000",//加长展示时间
    "showEasing": "swing",//显示时的动画缓冲方式
    "hideEasing": "linear",//消失时的动画缓冲方式
    "showMethod": "fadeIn",//显示时的动画方式
    "hideMethod": "fadeOut" //消失时的动画方式
};
</script>
4、默认的放置位置positionClass只有上top下bottom,并没有垂直居中

toast-top-left 顶端左边 
toast-top-right 顶端右边
toast-top-center 顶端中间
toast-top-full-width 顶端,宽度铺满整个屏幕 
toast-botton-right
toast-bottom-left
toast-bottom-center
toast-bottom-full-width
这时候,我们需要去原生的css中添加以下代码,

.toast-center-center {
           top: 50%;
           left: 50%;
           margin-top: -30px;
           margin-left: -150px;
        }
在应用的时候,把默认positionClass的值修改为.toast-center-center,这样就可以水平垂直都居中啦~

toastr.options.positionClass = 'toast-center-center';

版权声明:本篇文章来源于网络。 来源链接

相关推荐
TypeError: e.indexOf is not a function解决方法
jQuery | 2020-06-23 6336
This error might be caused by jquery event aliases like .load, .unload or .error deprecated since jQuery 1.8. Look for these aliases in your code and replace them with .o...
jquery出现Uncaught TypeError: $(...).prop is not a function问题
jQuery | 2019-08-23 6336
做全选功能的时候用到 var xz = $(this).prop("checked"); 提示: Uncaught TypeError: $(...).prop is not a function 应该是jquery版本过低造成的,更换高版本成功解决问题, jquery下载地址 http://www...
评论:0条
评论加载中...
发表评论