Favicon: Make a use of your favicon with badges, images or videos

Favicon.js jQuery plugin allows you tu to use your favicon with badges, images or videos

Animate your favicon with animated badges (slide, fade, pop, etc…).

You can customize type of animation, position, background color and text color.

Download: https://github.com/ejci/favico.js

Demonstration: http://lab.ejci.net/favico.js/

Plugin homepage: http://lab.ejci.net/favico.js/

Implementation:

  1. First, include the jQuery files
<!-- jQuery files -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="favicon-0.3.4.min.js"></script>

2. Now, call Favicon plugin

<script type="text/javascript">
  $(document).ready(function(){
    // Simple call
    var badge = 5; // Set badge value
    var favicon = new Favico(); // Create favicon
    
 
    // Call Favicon plugin with options
    var badge = 5; // Set badge value
    var favicon = new Favico({
        animation : 'popFade', // set animation type
        bgColor : '#000', // set the badge bgcolor
        textColor: '#fff', // set the badge text color
        fontFamily : 'Arial' // set the badge font-family property
    });
  });
</script>

3. Play with badge values

<script type="text/javascript">
  $(document).ready(function(){
 
    // Add +1 to bagde value when clicking on a button with id="plusOne"
    // exemple <button id="plusOne">+1</button>
    $('#plusOne').click(function() {
        badge = badge + 1;
        favicon.badge(badge);
    });
 
    // Add -1 to bagde value when clicking on a button with id="minusOne"
    // exemple <button id="minusOne">-1</button>
    $('#minusOne').click(function() {
        badge = (badge-1 < 0) ? 0 : (badge - 1);
        favicon.badge(badge);
    });
 
    // Reset badge value = hide badge
    // exemple <button id="reset">Reset badge</button>
    $('#reset').click(function() {
        favicon.reset();
    });
  });
</script>

4. Show image, video or webcam instead of your favicon

<script type="text/javascript">
  $(document).ready(function(){
 
    // Show an existing image on your webpage
    var favicon=new Favico();
    var image=document.getElementById('imageId');
    favicon.image(image);
 
    // Show a video instead of your classical favicon
    var favicon=new Favico();
    var video=document.getElementById('videoId');
    favicon.video(video);
    //stop the video
    favicon.video('stop');
 
    // Show your webcam instead of your classical favicon
    var favicon=new Favico();
    favicon.webcam();
    //stop
    favicon.webcam('stop');
  });
</script>

Options:

bgColorStringDefault : #d00 – Badge background color
textColorStringDefault : #fff – Badge text color
fontFamilyStringDefault : sans-serif – Text font family (Arial, Verdana, Times New Roman, serif, sans-serif,…)
fontStyleStringDefault : bold – Font style (normal, italic, oblique, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900)
typeStringDefault : circle – Badge shape (circle, rectangle)
positionStringDefault : down – Badge position (up, down, left, upleft)
animationStringDefault : slide – Badge animation type (slide, fade, pop, popFade, none )
elementIdBooleanDefault : false – Image element ID if there is need to attach badge to regular image

Screenshots

AJAX Post With jQuery and PHP

AJAX stands for Asynchronous JavaScript and XML. AJAX Post used to create faster, and more interacti…

How a Loop Through a JavaScript Object?

How a Loop through a JavaScript object?Javascript Objects are Variables Containing Variables.In Java…

How to Search Item in List in JavaScript

Multi Step Form Using HTML and JavaScript

Form is the important part in web design. Form is the primary interface to the user by which user is…

How to Create Custom CSS, jQuery Autocomplete Plugin

Web developers often use autocomplete features in websites as a part of their work. Yet lot of good …

How to Make Sticky Sidebar Using jQuery and CSS

Sticky sidebar is an essential part of web development. Not in all cases but for some cases where ou…