(function(){
notification = function notification() {
var slidingSelector = 'pn-show-slide-effect';
var tap = true;
var notificationEl = $(".pn-notification");
var notificationTextEl = $('.pn-notification-text');
// starts animating with a delay to opacity 0 and then removes the notification.
function _startAnimating(aDelay) {
notificationEl.animate({opacity: 0}, aDelay, function() {
_removeNotification(3000);
});
tap = true;
};
// Removes the notification with a dealy and sets the opacity to 1.
function _removeNotification(aDelay) {
notificationEl.removeClass(slidingSelector).animate({opacity: 1}, aDelay);
};
// stop the animation and sets the opacity to 1 to show message.
function _stopAnimating() {
notificationEl.stop().animate({opacity: 1});
tap = false;
};
function _init(aMessage) {
// inserting the message to the display text element.
notificationTextEl.html(aMessage);
/*
* This block will add css selector for sliding behaviour,
* Listeners for mouse leave and enter,
* touch event for tablet.
*/
notificationEl.addClass(slidingSelector).one('mouseenter', function() {
_stopAnimating();
})
.one('mouseleave', function() {
_startAnimating(500);
})
.on('touchstart', function() {
if(tap) {
_stopAnimating();
} else {
_startAnimating(500);
}
});
// calling to show the notification;
//_startAnimating(5000);
};
return {
show : function(aMessage) {
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.