toggle
Example heading with h2 size
Example heading with h3 size
Following is sample java code.
<!DOCTYPE html>
<html>
<head>
<title>Color Toggle App</title>
<style>
#colorWheel {
display: flex;
}
.colorBox {
width: 100px;
height: 100px;
margin: 10px;
transition: background-color 0.5s;
}
#box1 { background-color: red; }
#box2 { background-color: green; }
#box3 { background-color: blue; }
#box4 { background-color: yellow; }
</style>
</head>
<body>
<div id="colorWheel">
<div class="colorBox" id="box1"></div>
<div class="colorBox" id="box2"></div>
<div class="colorBox" id="box3"></div>
<div class="colorBox" id="box4"></div>
</div>
<button id="toggleButton">Toggle Colors</button>
<script>
window.onload = function() {
var boxes = document.getElementsByClassName('colorBox');
// Initialize the background color for each box
boxes[0].style.backgroundColor = 'red';
boxes[1].style.backgroundColor = 'green';
boxes[2].style.backgroundColor = 'blue';
boxes[3].style.backgroundColor = 'yellow';
document.getElementById('toggleButton').addEventListener('click', function() {
var firstColor = boxes[0].style.backgroundColor;
for (var i = 0; i < boxes.length - 1; i++) {
boxes[i].style.backgroundColor = boxes[i + 1].style.backgroundColor;
}
boxes[boxes.length - 1].style.backgroundColor = firstColor;
});
};
</script>
</body>
</html>