Code Monkey home page Code Monkey logo

toastr's Introduction

Toastr

项目介绍

非堵塞消息通知插件

演示

https://wispx.gitee.io/toastr/demo.html

使用方法

注意 本插件依赖Jquery 下载项目,引入jquery和src目录下的css/toastr.css和js/tosatr.js

<link rel="stylesheet" href="css/toastr.min.css">
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/toastr.min.js"></script>
全局配置
$.toastr.config({
  time: 3000,
  position: 'top-right',
  size: '',
  callback: function () {}
});

配置说明:

配置名 配置说明 可选参数 默认值
time 关闭时间(毫秒) 1000~999999之间的纯数字 3000
position 显示位置 top-left,top-center,top-right,right-bottom,bottom-center,left-bottom top-right
size 大小 lg,sm,xs 空(正常大小)
callback 默认关闭后的回调 function

显示一个成功通知,并设置一个关闭后的回调
$.toastr.success('执行成功', {
    callback: function() {
      console.log('执行回调')
    }
});
在左上角显示一个信息通知
$.toastr.info('有新消息了', {
    position: 'top-left'
});
显示一个警告通知,1秒后关闭
$.toastr.warning('警告,禁止操作!', {
    time: 1000
});
显示一个大小为sm的失败通知
$.toastr.error('执行失败!', {
    size: 'sm'
});
清除所有通知
$.toastr.clear();

License

  • MIT license

toastr's People

Contributors

wisp-x avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.