jquery to animate a flash to the button selected code example

Example 1: how to animate a flash in jquery

$("#someElement").fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);

Example 2: set flash on a button using jquery

$(document).ready(() => { 
	setInterval(() => { 
		$('p').fadeIn(); 
		$('p').fadeOut(); 
	}, 500); 
});

Example 3: jquery to animate a flash to the button selected

var buttonColours=["red", "blue", "green", "yellow"];
var gamePattern=[];

function nextSequence(){
  var randomNumber = Math.floor(Math.random()*4);
  var randomChosenColour= buttonColours[randomNumber];
  gamePattern.push(randomChosenColour);
  $("#randomChosenColour").fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
 }

Tags:

Misc Example