Talking about Css, Javascript and Tutorials.
How many times you had to choose your country in a form, with a old, simple popup?
Time to change the way you choose your country (or anything else) with a bit of Css and Javascript.
I am showing the example in a iframe not to mess with WordPress styles.
As you can see, when you move the mouse over the text input, a list with (almost) every world country and flag appears, and when you click on a country, its ISO code is displayed into the text input.
When you move the mouse out of the country list, it closes.
How can it be made?
Let’ see the content of the main page
other content here other content here other content here
The trick is in the <a> and <span> css use, with a display attribute changing on hover status.
It’s easiest to see than to explain.
Let’s look at line 34, when I call the iframe I simply load an ordered list with a javascript to communicate with the “parent” page.
- afghanistan
- åland islands
- albania
...
...
Look how I set the menu starting with an unordered list with Css (lines 5-10) and how I pass ISO values to the parent page (line 15 for example).
You can download the whole work here, check 2 html files and give me feedback or suggestion about the use of this feature.
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.