Cara menggunakan self close javascript

Notify.js is a jQuery plugin to provide simple yet fully customisable notifications. The javascript code snippets in this documentation with the

$(".elem-demo").notify("Hello Box");
0 edge are runnable by clicking them.

Show
$.notify("Hello World");
Cara menggunakan self close javascript

Element Notifications

You can place notifications on any element:

$(".elem-demo").notify("Hello Box");

Like this box

Global Notifications

If you don't specify an element, notification will appear in the top left (unless you specify a different position - See Positioning)

$.notify("I'm over here !");

Notification Styles

Each style may define a set of classes to use to substyle the notification. The pre-packaged version includes a bootstrap notification style (see more below in Styling). These classes include:

Success

$.notify("Access granted", "success");
Info
$.notify("Do not press this button", "info");
Warning
$.notify("Warning: Self-destruct in 3.. 2..", "warn");
Error
$.notify("BOOM!", "error");

Note: This page has set the default class to

$(".elem-demo").notify("Hello Box");
1 with
$(".elem-demo").notify("Hello Box");
2.

Positioning

The

$(".elem-demo").notify("Hello Box");
3 string option is used to describe both vertical and horizontal alignment. Element notifications and Global notifications can be vertically repositioned to:
$(".elem-demo").notify("Hello Box");
4,
$(".elem-demo").notify("Hello Box");
5or
$(".elem-demo").notify("Hello Box");
6and horozontally repositioned to:
$(".elem-demo").notify("Hello Box");
7,
$(".elem-demo").notify("Hello Box");
8or
$(".elem-demo").notify("Hello Box");
9. If we don't provide a
$(".elem-demo").notify("Hello Box");
3 option the default alignments are defined in the default settings:
$.notify("I'm over here !");
1 and
$.notify("I'm over here !");
2. When only one alignment is provided, the vertical alignment is
$.notify("I'm over here !");
3 and horizontal alignment is
$.notify("I'm over here !");
4.

$(".pos-demo").notify(
  "I'm to the right of this box", 
  { position:"right" }
);

We can position the notification around this box

Use this positioning tool to see all possible

$(".elem-demo").notify("Hello Box");
3 combinations.

An awesome cool larrrggggeeee box

API

$.notify("I'm over here !");
6
$.notify("I'm over here !");
7
$.notify("I'm over here !");
8
$.notify("I'm over here !");
9
$.notify("Access granted", "success");
0

$.notify("I'm over here !");
7 - global notification data
$.notify("I'm over here !");
9 - an options object or class name string

$.notify("I'm over here !");
6
$.notify("Access granted", "success");
4
$.notify("Access granted", "success");
5
$.notify("I'm over here !");
7
$.notify("I'm over here !");
8
$.notify("I'm over here !");
9
$.notify("Access granted", "success");
0

$.notify("Access granted", "success");
4 - a jquery element
$.notify("I'm over here !");
7 - element notification data
$.notify("I'm over here !");
9 - an options object or class name string

$.notify("Do not press this button", "info");
3
$.notify("Do not press this button", "info");
4
$.notify("Do not press this button", "info");
5
$.notify("I'm over here !");
7
$.notify("I'm over here !");
8
$.notify("I'm over here !");
9
$.notify("Access granted", "success");
0

$.notify("Do not press this button", "info");
4 - jquery selector
$.notify("I'm over here !");
7 - element notification data
$.notify("I'm over here !");
9 - an options object or class name string

$.notify("Warning: Self-destruct in 3.. 2..", "warn");
3
$.notify("Warning: Self-destruct in 3.. 2..", "warn");
4
$.notify("Access granted", "success");
5
$.notify("Warning: Self-destruct in 3.. 2..", "warn");
6
$.notify("Warning: Self-destruct in 3.. 2..", "warn");
7

$.notify("Warning: Self-destruct in 3.. 2..", "warn");
4 - string (the style option references this name)
$.notify("Warning: Self-destruct in 3.. 2..", "warn");
6 - style definition object (see Styling below)

$.notify("BOOM!", "error");
0
$.notify("I'm over here !");
9
$.notify("Warning: Self-destruct in 3.. 2..", "warn");
7

$.notify("I'm over here !");
9 - an options object (updates the defaults listed below)

Options

The options object listed above are in the form below. This object below is the actual used to check option validity and set defaults.

{
  // whether to hide the notification on click
  clickToHide: true,
  // whether to auto-hide the notification
  autoHide: true,
  // if autoHide, hide after milliseconds
  autoHideDelay: 5000,
  // show the arrow pointing at the element
  arrowShow: true,
  // arrow size in pixels
  arrowSize: 5,
  // position defines the notification position though uses the defaults below
  position: '...',
  // default positions
  elementPosition: 'bottom left',
  globalPosition: 'top right',
  // default style
  style: 'bootstrap',
  // default class (string or [string])
  className: 'error',
  // show animation
  showAnimation: 'slideDown',
  // show animation duration
  showDuration: 400,
  // hide animation
  hideAnimation: 'slideUp',
  // hide animation duration
  hideDuration: 200,
  // padding between element and notification
  gap: 2
}

Custom Styling Guide

You can add your own styles to Notify.js with the

$.notify("BOOM!", "error");
4method. See API.

Style definition objects are in the form:

{
  //required html representing each notification 
  html: "",
  //optional object to be converted to css
  classes: {
    : {
      :  
    },
    : {
      ...
    },
    ...
  },
  //optional css to be inserted onto the page
  css: ""
}
html
- If you only have HTML element that you need to modify per notification then you should give this element an attribute of
$.notify("BOOM!", "error");
5 or
$.notify("BOOM!", "error");
6. Use
$.notify("BOOM!", "error");
6 if you wish to display arbitrary HTML inside the notification, otherwise, use
$.notify("BOOM!", "error");
5 as it is more secure.
Otherwise, if you wish to modify multiple HTML elements per notification then you'll need to give each element one of the two attributes above as well as a value. For an example of this see the Advanced Example below.
classes
- This object will be used to construct css. It must be in the form described above and there is an example below.
css
- This string is simply raw css. Use this property if you want to keep your style definition inside your js files.

Class naming convention

When each notification is constructed, it's container (outer most element defined in your style html) will automatically apply the class: