jquery toastmessage (Jquery类似安卓消息提示框)
Do you wanna have some toasts ?
jquery-toastmessage-plugin is a JQuery plugin which provides android-like notification messages. The toasted messages arriving on the screen in a seamless and natural way. They may or may not disrupt the user and they are still informative. It's a quite nice way to report info or error to the user.
The plugin is entirely customizable. So you can change the positioning, the required user action, the style and so on.
Getting the plugin
The plugin is packaged inside a Jar file (Java Archive). So just download the jar file and unzip it:
jquery.toastmessage.js <-- the plugin
css/jquery.toastmessage.css <-- the css file
images/error.png <-- image
images/close.gif <-- image
images/notice.png <-- image
images/success.png <-- image
images/warning.png <-- image
META-INF/MANIFEST.MF
META-INF/LICENSE
META-INF/NOTICE
You can also directly grab the files from the latest TAG from github https://github.com/akquinet/jquery-toastmessage-plugin/tree/jquery-toastmessage-plugin-0.2.0.
To get the plugin to work, you need the plugin javascript file, the css file and a couple of images.
Types of toast messages
You have 4 different toast types you can use. Each type comes with its own icon and colored border. The types are:
- notice
- success
- warning
- error
The following methods will display a toast message:
$().toastmessage('showNoticeToast', 'some message here');
$().toastmessage('showSuccessToast', "some message here");
$().toastmessage('showWarningToast', "some message here");
$().toastmessage('showErrorToast', "some message here");
These toast messages are shown on the upper right side of your browser and will stay for some time before they will fade out automatically.
To remove a special toast you can do that with
$().toastmessage('removeToast', toastObject);
Example:
// reconfiguring the toasts as sticky
$().toastmessage({sticky : true});
// saving the newly created toast into a variable
var myToast = $().toastmessage('showNoticeToast', 'some message here');
// removing the toast
$().toastmessage('removeToast', myToast);
Configuration of your toasts
Sometime the predefined settings are not the good ones. You can alter the configuration to your special use case.
// user configuration of all toastmessages to come:
$().toastmessage('showToast', {
text : 'Hello World',
sticky : true,
position : 'top-right',
type : 'success',
close : function () {console.log("toast is closed ...");}
});
These are the provided configuration properties with its default values:
inEffectDuration: 600, // in effect duration in miliseconds
stayTime: 3000, // time in miliseconds before the item has to disappear
text: '', // content of the item
sticky: false, // should the toast item sticky or not?
type: 'notice', // notice, warning, error, success
position: 'top-right', // top-left, top-center, top-right, middle-left, middle-center, middle-right
// Position of the toast container holding different toast.
// Position can be set only once at the very first call,
// changing the position after the first call does nothing
closeText: '', // text which will be shown as close button,
// set to '' when you want to introduce an image via css
close: null // callback function when the toastmessage is closed
Besides global configuration for all of your toasts. There is also a more general toast method provided where you can modify the special toast on your hand.
$().toastmessage('showToast', {
text : 'Some information for you ...',
sticky : true,
type : 'notice'
});
This will show a toastmessage of type 'success' which is sticky and will not fade away by itself. All other already showed
To see some more examples please have a look into the Tests in src/test/javascript/ToastmessageTest.js
For further style configuration please see corresponding css file: src/main/resources/css/jquery-toastmessage.css
Disclaimer
This plugin is based on the jquery-notice (http://sandbox.timbenniks.com/projects/jquery-notice/) but is enhanced in several ways:
- configurable positioning
- convenience methods for different message types
- callback functionality when closing the toast
- included some nice free icons
License
jquery-toastmessage-plugin is licensed under the Apache License 2.0. The project is founded byakquinet A.G.
jquery toastmessage (Jquery类似安卓消息提示框)的更多相关文章
- 基于jQuery消息提示框插件Tipso
今天要分享的这款jQuery消息提示框插件名叫Tipso,它的特点是可以定义提示框的显示位置,以及动态改变提示框的提示内容,应该说是一款相当灵活的jQuery消息提示框插件.效果图如下: 在线预览 ...
- 基于Jquery 简单实用的弹出提示框
基于Jquery 简单实用的弹出提示框 引言: 原生的 alert 样子看起来很粗暴,网上也有一大堆相关的插件,但是基本上都是大而全,仅仅几句话可以实现的东西,可能要引入好几十k的文件,所以话了点时间 ...
- JS~Boxy和JS模版实现一个标准的消息提示框
面向对象的封装 面向对象一个入最重要的特性就是“封装”,将一些没有必要公开的方法和属性以特定的方式进行组装,使它对外只公开一个接口,外界在调用它时,不需要关注它实现的细节,而只要关注它的方法签名即可, ...
- (二)easyUI之消息提示框
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- MFC上下浮动与渐入渐出消息提示框实现
类似QQ与360软件,消息提示有两种.上下浮动.渐入渐出. 1.上下浮动提示框实现 机制,定时器响应上下浮动消息. 主要API:MoveWindow. 源码如下UpDownTipDlg.h.UpDow ...
- UWP中的消息提示框(二)
在UWP中的消息提示框(一)中介绍了一些常见的需要用户主动去干涉的一些消息提示框,接下来打算聊聊不需要用户主动去干涉的一些消息提示框.效果就是像双击退出的那种提示框. 先说说比较简单的吧,通过系统To ...
- Flutter Toast消息提示框插件
Flutter Toast消息提示框插件 在开发flutter项目中,想必大家肯定会用到toast消息提示,说到这里, 大家肯定会想到https://pub.dev/ 插件库, 但是插件市场上有太多类 ...
- 自定义iOS 中推送消息 提示框
看到标题你可能会觉得奇怪 推送消息提示框不是系统自己弹出来的吗? 为什么还要自己自定义呢? 因为项目需求是这样的:最近需要做 远程推送通知 和一个客服系统 包括店铺客服和官方客服两个模块 如果有新的消 ...
- Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog)
Android第三方开源对话消息提示框:SweetAlertDialog(sweet-alert-dialog) Android第三方开源对话消息提示框:SweetAlertDialog(sweet- ...
随机推荐
- HTTP 协议中 Vary 的一些研究
经常抓包看 HTTP 请求的同学应该对 Vary 这个响应头字段并不陌生,它有什么用?用 PageSpeed 工具检查页面时,经常看到「Specify a Vary: Accept-Encoding ...
- Windows Phone 7 开发环境的搭建
本节开始进行Windows Phone 开发环境的搭建,包括所需要的操作系统及硬件的介绍,开发工具的下载与安装,以及开发工具的介绍等.由于Jake Lin老师的视频中讲解的是早期的Windows Ph ...
- window.open("url?param="+paramvalue) 服务端 乱码问题解决
window.open("url?param="+paramvalue)传递参数出现乱码,在客房端显示是正常的,可是到服务端就是乱码. 1. 利用一个js在客户端转码的函数,esc ...
- Spring4.0+quartz2.2.1+memcahce多台nginx实现均衡
1.每台nginx都有公网地址,在域名处设置同个域名多个指向,最简单实现轮洵.但故障切负会慢一点.2.一台公网nginx通过upstream功能,轮洵.ip.url多方式分发到内网多台nginx.但公 ...
- Log4j输出格式控制
参数说明例子 %c 列出logger名字空间的全称,如果加上{<层数>}表示列出从最内层算起的指定层数的名字空间 log4j配置文件参数举例 输出显示媒介 假设当前logger名字空间是& ...
- UML状态图
状态图(Statechart digram)是系统分析的一种经常使用工具,系统分析员在对系统建模时,最先考虑的不是基于活动之间的控制流,而是基于状态之间的控制流,由于系统中对象的状态变化最易被发现和理 ...
- Linux下分割、合并PDF(pdftk),用于Linux系统的6款最佳PDF页面裁剪工具
Linux下分割.合并PDF(pdftk),用于Linux系统的6款最佳PDF页面裁剪工具 Linux下分割.合并PDF(pdftk) pdftk http://www.pdflabs.com/doc ...
- scala编程第18章学习笔记——有状态的对象
银行账号的简化实现: scala> class BankAccount{ | private var bal: Int = 0 | def balance: Int = bal | def de ...
- 上下变换中 aspect的选择
在电视制作还没有完全整转到高清之前,有很多原来的SD素材需要转到HD信号进入高清切换或者编辑平台,电视台是电视节目的发射源端 ,所以上变换过程不能引入额外的噪声或者失真: 上变换使用的方式一般有4种: ...
- go语言基础之new函数
1.new函数 表达式new(T)将创建一个T类型的匿名变量,所做的是为T类型的新值分配并清零一块内存空间,然后将这块内存空间的地址作为结果返回,而这个结果就是指向这个新的T类型值的指针值,返回的指针 ...