Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Cross-browser blink feature

0.00/5 (No votes)
20 Mar 2013 1  
The Blink Feature in Netscape browsers is really a cool one. Here we would bring in the Blink feature for Microsoft Internet Explorer using a simple JavaScript trick.
Introduction 

I would like to start with a small history of why this Blink in web browser requirement came at all. I had a small requirement for a small regional client here, in freelance. They wanted blinking in certain parts of the page for information that is marked from the admin section of the site, basically to emphasize any new or impressive information. 

Tags Availability 

I know there is a BLINK tag in Netscape, but again that does not work in MSIE, which has its own properitary MARQUEE tag for scrolling. I searched the Internet and got some custom BLINKERs, but then the blinkers made the page jump every time the DIV was set to invisible. After a long search, I got this small code snippet which I refined a bit and which I would like to share with anyone who needs a similar code compatible across both MSIE and Netscape.

A few months back I had shared a bit of code which would accomplish this for Netscape and IE using proprietary JavaScript techniques.  Recently I just thought I would enhance this using standard jQuery and minimal code. 

Method

  1. A simple and standard DIV with a particular class can be used. 
  2. With a simple JavaScript timer the visibility of the class is toggled. 

How to Use 

Currently the attached zip file has only one static blink.htm page. It utilizes jQuery from Google CDN. The code in the $(".blink") function is the one which designates the DOM elements that need to be blinked. 

Summary

The intent of this article is demonstrating the use of jQuery towards making a browser-independant code for even features that were conceived once upon a time as browser-specific features. The highlight is also towards using CDN URLs in lieu of local URLs so that performance and maintenance are significantly and greatly improved. 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here