Javascript to make some links blink

Mark each anchor tag (<a href…) with rel=”blinking” to make the tag blink (not very clever, but sometimes useful). This…

Novembre 9, 2009

Mark each anchor tag (<a href…) with rel=”blinking” to make the tag blink (not very clever, but sometimes useful).

This code uses prototype.js function “$$”.

function blinking() {
	var a = $$('a[rel="blinking"]');
	var t = 50;
	for (i=0 ; i < a.length;  i++) {
		if (a[i].style.visibility=='hidden') {
			a[i].style.visibility='visible';
			/* stays on for 2 seconds */
			t = 2000; 
		} else {
			a[i].style.visibility='hidden';
			/* stays off for 50 milliseconds */
			t = 50;
		}
	}
	setTimeout("blinking();",t);
}

Author

PHP expert. Wordpress plugin and theme developer. Father, Maker, Arduino and ESP8266 enthusiast.

Recommended

Modify list counter in :before pseudo class with jQuery using start attribute

Suppose you have two ordered list ol tags, and the second one has a start attribute. You also have in…

Aprile 20, 2016

The Quantcast CMP broke my sites

A javascript error in CMP blocks my site.

Maggio 19, 2023

Scroll to DIV by ID without jQuery

Use scrollIntoView instead of jQuery animate.

Dicembre 16, 2022

React links

Collection of links and notes while approaching React.js, next.js and related topics.

Dicembre 14, 2022

Add Internet Explorer class to body to detect old browser

When you have clients that still uses an old browser, you need to handle it. This javascript function detects the…

Febbraio 27, 2017