- Cats
- Dogs
- Monkeys
"Miau, miau," says the cat.
"Wuff, wuff," barks the dog.
"I need some bananas," says the monkey.
Create some glowing tabs and boxes with CSS animation and JavaScript!
If you click one of the tabs shown above the related text box will fade in into the front of the screen. As described in the previous posts we use the CSS animation property. This time the animation should fire when a tab is clicked so we use the JavaScript onclick event and assign to each tab a different function. Clicking a tab applies a specific value to the CSS animation property invoking the glowing effect. The JavaScript syntax is as follows:
document.getElementById("ID of the tab").style.WebkitAnimation="value details";
document.getElementById("ID of the tab").style.animation="value details";
If one tab is glowing the rest should be transparent therefore the other animation properties have no value describing with "". The same time a tab is glowing its related text box should also visible which is done by setting the z-index to "2". The syntax is document.getElementById("the ID of the box").style.zIndex="2";
If you click one of the tabs shown above the related text box will fade in into the front of the screen. As described in the previous posts we use the CSS animation property. This time the animation should fire when a tab is clicked so we use the JavaScript onclick event and assign to each tab a different function. Clicking a tab applies a specific value to the CSS animation property invoking the glowing effect. The JavaScript syntax is as follows:
document.getElementById("ID of the tab").style.WebkitAnimation="value details";
document.getElementById("ID of the tab").style.animation="value details";
If one tab is glowing the rest should be transparent therefore the other animation properties have no value describing with "". The same time a tab is glowing its related text box should also visible which is done by setting the z-index to "2". The syntax is document.getElementById("the ID of the box").style.zIndex="2";
No comments:
Post a Comment