FANDOM


Forums: Index > Help desk > Alternating infobox at the click of a button


Hi there. I'm looking to add a feature into an existing template on Robot Wars Wiki. 99% of the coding on our Wiki has been me experimenting with trial and error, but this one is beyond me.

Take a robot like Panic Attack.

http://robotwars.wikia.com/wiki/Panic_Attack

Basically there were six versions of the robot ever made. As it is, we can only display one image and one set of statistics; the rest is spread throughout the article.

What I would like is the feature that COD Wiki (and others, but this is the only one I can find) has for the AK-47.

http://callofduty.wikia.com/wiki/AK-47#MWR

See how you can click the "tab" at the top to change from COD4 to MWR? I want to be able to program that onto our Template:Robot. I want all of the information besides the heading to change depending on which tab is selected.

My questions are as follows:

1. Is it possible to have one template that we can then program a number of "tabs". Some robots have one appearance and therefore don't need a tab, and others have 8. 2. Do I need to create two templates, one for non-tab robots and one for tab robots, OR do I need to create 12 templates based on how many versions of the robot there are?

Can someone help me? I'm not even sure what the feature is called, so am lost for where to start. Toon Ganondorf (t c) 10:29, December 5, 2017 (UTC)

Additionally, I cannot follow this forum to get email updates when people edit it, so can someone please drop a quick message on my talk page if there's activity here so I can check it? Toon Ganondorf (t c) 10:33, December 5, 2017 (UTC)
Actually, this is possible using the <gallery> tag. Take the following code:
<gallery>
PanicAttack.jpg | Panik Attack
Roadblock.jpg   | Road Block
</gallery>

That would then cause Panik Attack's image to be the default, but allow for a tab called "Road Block" that, when pressed, would show Road Block's image. This can be included as-is above in the images variable without requiring modifications to the main template.--TwoTailedFox (talk) 19:15, December 7, 2017 (UTC)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.