Documentation
Getting Started
jqxNotification represents a jQuery widget which displays an unobtrusive notification to the user. Multiple instances of the same notification can be shown at the same time.Every UI widget from jQWidgets toolkit needs its JavaScript files to be included in order to work properly.
The first step is to create html page and add links to the javascript files and css dependencies to your project. The jqxNotification widget requires the following files:
<head> <link type="text/css" rel="Stylesheet" href="../../jqwidgets/styles/jqx.base.css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxnotification.js"></script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head>
The next step is to create a DIV element within the body of the html document and add the notification's content in it. The content can be text or HTML code.
<div id="jqxNotification"> Welcome to our website!</div>
The last step is to initialize the widget by adding the following script to the html document:
<script type="text/javascript"> $(document).ready(function () { $("#jqxNotification").jqxNotification({ width: "auto", position: "top-left", opacity: 0.9, autoOpen: true, autoClose: false, template: "info" }); });</script>
To call a function(method), you need to pass the method name and parameters(if any) in the jqxNotification’s constructor.
To set a property(option), you need to pass the property name and value(s) in the jqxNotification's constructor.$("#jqxNotification").jqxNotification("open");
To get a property(option), you need to pass the property name to the jqxNotification's constructor.$("#jqxNotification").jqxNotification({ position: "top-right" });
To bind to an event of a UI widget, you can use basic jQuery syntax. The example code below demonstrates how to bind to the "close" event of jqxNotification.var position = $("#jqxNotification").jqxNotification("position");
// bind to close event.$("#jqxNotification").bind("close", function (event) {alert("Notification was closed.");});
Basic Sample
<!DOCTYPE html><html><head> <title>jQuery Notification Sample</title> <link type="text/css" rel="Stylesheet" href="../../jqwidgets/styles/jqx.base.css" /> <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxnotification.js"></script> <script type="text/javascript"> $(document).ready(function () { $("#jqxNotification").jqxNotification({ width: "auto", position: "top-left", opacity: 0.9, autoOpen: true, autoClose: false, template: "info" }); }); </script><script async src="https://www.googletagmanager.com/gtag/js?id=G-2FX5PV9DNT"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'G-2FX5PV9DNT');</script></head><body> <div id="jqxNotification"> Welcome to our website!</div></body></html>