• Stars
    star
    373
  • Rank 114,600 (Top 3 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created about 11 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An all in one jQuery plugin that let you change your favicon, browser's title and more to reflect new notifications

#Notify Better by Pete R. The ultimate all in one plugin for notification - Change your favicon, browser's title and more to reflect new notifications Created by Pete R., Founder of BucketListly

Demo

View demo

Compatibility

Dynamic favicon feature from this plugin only works with Chrome and Firefox. Unfortunately, Safari and IE do not allow you to change the favicon after page load.

If you are getting this error: "Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin." from our demo, try hosting this in your local server or if you are using OSX, move the demo folder into Library/WebServer/Documents and try visiting http://localhost/demo/index.html in your browser. The notification polling should work.

Usage

To add Notify Better plugin to your website, make sure you've included the latest jQuery library together with jquery.notify-better.js into your document's <head>. If you want the plugin to handle your favicon notification for you, make sure you add an id attribute to your favicon's link tag as follows:

<link rel="shortcut icon" id="favicon" href="favicon.png"> 

And then all you have to do is call the function on the container you wish the count to be displayed.:

$("#notification").notify_better({
  interval: 2000, // Interval between each polling in milliseconds. If you want notification to update faster, lower the number or vice versa. Set to 0/false to execute only once on page load. Default is 5000 (5 seconds)
  url: "random_count.html", // The URL to retrieve the notification count.
  overrideAjax: false, // Allows you to override the whole ajax call to your notification in case you want to customise it. See more under Further Customization.
	updateTitle: false, // Dynamically Add notification count to your website's title
  updateFavicon: { // Enable you to show notification on top of your favicon dynamically
    id: "favicon",  // the ID of your favicon link tag (as shown above)
    backgroundColor: "#f1c40f", // Background color of your notification count
    textColor: "#6D461D", // Text color of your notification count
    location: "full", // Position of your notification count. Can be "full", "ne", "se", "sw", "nw". The default is full.
	  shape: "square" // Shape of the notification counter. Can be circle or square.
  },
  done: function() { // A Callback when the function is completed.
    alert("done!")
  }
});

There maybe times when you want to remove all these notifications. Simply call the clear function and everything will be reverted back to its original version.

$("#clear-notification").click(function() {
  $("#notification").clear();
});

Further Customization

With Notify Better, you can override our predefined ajax call in case you want to do more customisation. Here's an example of overriding the predefined ajax call with your own function:

$("#notification").notify_better({
  overrideAjax: function() {
    $.ajax({
      url: "count.html",
    }).done(function(data, textStatus, jqXHR) {
      titleclear(); // Notify Better default function to clear title 
      changeFavicon(data)  //  Notify Better default function to change favicon dynamically 
      ...
    });
  }
});

With overrideAjax, you can customise the way the notification count is returned from your server and displayed on your website. Please note that some features may not work unless you call our default function as shown above.

Now, no matter which tab your users are at, they will see the notification from your website right away without opening the tab. Pretty cool huh?

Other Resources

  • Tutorial (Coming Soon)

More Repositories

1

onepage-scroll

Create an Apple-like one page scroller website (iPhone 5S website) with One Page Scroll plugin
JavaScript
9,544
star
2

purejs-onepage-scroll

The javascript version of the infamous jQuery One Page Scroll without relying on jQuery.
JavaScript
770
star
3

simple-text-rotator

Add a super simple rotating text to your website with little to no markup
HTML
748
star
4

loading-bar

Add a Youtube-like loading bar to all your ajax links
HTML
661
star
5

label_better

Label your form input like a boss with beautiful animation and without taking up space
JavaScript
517
star
6

flat-shadow

A small jQuery plugin that will automatically cast a shadow creating depth for your flat UI elements
HTML
483
star
7

panorama_viewer

Embed panorama photos on your website with Panorama Viewer
JavaScript
473
star
8

wheel-menu

Add a fully customisable Path-like wheel menu button to your website
HTML
403
star
9

interactive_3d

Create a 3D interactive object using images and one simple JS call
JavaScript
378
star
10

tiltedpage_scroll

Create a beautiful 3D tilted effect on scroll with jQuery Tilted Page Scroll plugin
JavaScript
323
star
11

autofix_anything

Fix position of anything on your website automatically with one js call
JavaScript
314
star
12

interactive_bg

Create an interactive moving background/object that reacts to viewer's cursor
JavaScript
232
star
13

shuffle-images

The Simplest Way to shuffle through images in a Creative Way
JavaScript
212
star
14

tip_cards

Create a card layout that let your user flip through it like you see on Google Tips
JavaScript
211
star
15

zepto-onepage-scroll

Zepto One Page Scroll is the javascript version of the infamous jQuery One Page Scroll.
JavaScript
186
star
16

adaptive-modal

Create modal windows that can be morphed from anything
JavaScript
168
star
17

fancy-scroll

Add Overflow Scroll Effect like on iOS/Android but for your website
HTML
157
star
18

immersive-slider

Create an immersive slider that changes the whole container to match the viewing slide
JavaScript
138
star
19

square_menu

Create a Square-like Menu Animation for Website using jQuery and CSS3
CSS
124
star
20

fly_sidemenu

Recreate an Airbnb iOS7 App Menu Animation using CSS3 and jQuery
CSS
113
star
21

flipout_cards

Create a Dynamic Multi Level Flip Out Cards
CSS
110
star
22

fullpage-menu

Create a Full Page, Fully CSS3 Animated Menu for your Navigation with Full Page Menu
CSS
106
star
23

jumpto

A plugin that let you create a smooth jump to sub navigational menu in one JS call
JavaScript
105
star
24

zoom-scroller

Create a Subtle Zoom Animation on Images while Scrolling
JavaScript
99
star
25

let_it_snow

Create and Control a Festive Snow on Your Website using HTML5 Canvas
JavaScript
92
star
26

endpage-box

A plugin that let you add an end page box that will display when scrolled to the bottom.
HTML
86
star
27

flipping_gallery

Create a simple but beautiful 3D flipping gallery with on JS call
JavaScript
79
star
28

subscribe-better

Create a better, highly customizable subscription modal or newsletter signup window with jQuery Subscribe Better
CSS
74
star
29

planetarium

Construct an Interactive Planet and Build the Universe on your website
JavaScript
58
star
30

flipping_text

Create a ticking text intro animation for your typography.
JavaScript
55
star
31

fullpagenav

Create a fully responsive and dynamic full page navigation with one JS call
JavaScript
35
star
32

parallax-scroller

Scroll through lists with a smooth parallax effect
JavaScript
27
star
33

flatline_icon_free

180+ high quality & minimal icons webfont for Bootstrap Framework
26
star
34

endpage_next

Navigate without moving your mouse. Pull to refresh/Hold to go next functionality on the web,
JavaScript
12
star