samedi 9 janvier 2016

jquery nested json with if condition

I found some examples for nested json code and how to access the values from it, but I couldn't get it to work in combination with my example. Maybe you can help me?

Here is my project folder as it is easier to get the code at once: code-3

I'm loading json data to create all the dots at the bottom. They represent all the earthquake/tsunamis that occured over a certain period. When you click on a dot a hidden div shows up with the size of the dot you clicked. You can click on another one to show them up in an second div. When I continue in the project, you should have the possility always to compare 2 tsunamis with additional graphical elements. At the moment there are categories around the dot in the top. They represent how far waves have gone from the epicenter.

Task: The category rings are actually all hidden. When I click on a dot at the bottom, I need the json info for all 5 categories. If the they have a 1 (=active) div "c1" should show up, the same for c2 and so on. If there is a 0 in the value, the div remains hidden. Therefore I need to know how to get this values and how to write the if condition. Later on I will set the radius for the wave rings also via JS due to each dot has a different size and I need always them distance from it's borders.

Cheers!

Aucun commentaire:

Enregistrer un commentaire