1.0.0 • Published 6 years ago

iaso-alerterjs v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

About

alerter is a vanilla javascript (meaning it does not require jQuery nor any other library) "plug-in", which lets you display non-obstrusive stackable messages in an easy and ordered way.

Working example.

Usage

Using alerter is easy! alerter('Hello, World!'); will display a box with the text "Hello, World!", it's that easy.

If you need more options, you can pass a configuration object instead of a string alerter({'text': 'Hello, World!', 'orientation': 'left'});

Configuration

The default configuration works most of the times, but of course, you can customize as you please

NameMandatory?TypeDefault valueDescription
textyesstring'Default Alert Text'Alert text
durationyesnumber2Number of seconds before fadeOut (if onClick is set, starts when the alert is clicked)
fadeStepyesnumber5Fade out step
fadeSpeedyesnumber25Fade out speed
xOrientationyesstring ('left'/'right')'left'Alert placement on horizontal axis
yOrientationyesstring ('top'/'bottom')'top'Alert placement on vertical axis
stylesyesobject{height: '50px', margin: '15px'}Styles object
styles.heightyesstring'50px'Alert div height in px (Mandatory unit)
styles.marginyesstring'15px'Alert div margin in px (Mandatory unit)
styles.backgroundColornostring'#000000'Background color
styles.colornostring'#FFFFFF'Text color
styles.fontFamilynostring'Segoe UI'Font family
styles.fontSizenostring'13px'Font size
styles.paddingnostring'5px'Alert div padding
styles.minWidthnostring'250px'Alert div min width
styles.STYLE_ATTRIBUTE_NAMEnoAny style you want to add on the alert div
idnostringnoneOptional id (styles array has precedence)
classnostringnoneOptional css classname (styles array and id have precedence)
onFadeOutnofunctionnoneCallback called after fadeOut
onClicknofunctionnoneCallback called on click event

Installation

$ npm install alerterjs

You can find alerter in node_modules/alerterjs/alerter.js as well as node_modules/alerterjs/alerter.min.js.