Pdf/BaladeNature/Js/balade_nature.js
changeset 94 d8344a68c91f
parent 74 58e48a5c5ca2
child 124 f0f5895259d9
equal deleted inserted replaced
93:a36f61911d60 94:d8344a68c91f
     8 
     8 
     9 
     9 
    10 window.addEvent('domready', function(){
    10 window.addEvent('domready', function(){
    11     // Hotspots
    11     // Hotspots
    12     (function initialize() {
    12     (function initialize() {
    13         var scenario;
       
    14         var content;
       
    15         $$(".pdocHotspot").each(function(hotspot) {
    13         $$(".pdocHotspot").each(function(hotspot) {
    16             scenario = hotspot.getElement("span");
    14             var spot = $(hotspot.get('id') + "s")
    17             content = $(hotspot.get('id').replace("x", "z"))
    15             var scenario = hotspot.getElement("span");
    18             if (scenario && content) {
    16             if (spot && scenario) {
    19                 
       
    20                 hotspot.addEvent("click", function() {
    17                 hotspot.addEvent("click", function() {
    21                     var content = $(this.get('id').replace("x", "z"));
    18                     var spot = $(this.get('id') + "s");
    22                     content.setStyles({"opacity": 0, "display": "block"});
    19                     if (spot.getChildren("img")) {
       
    20                         spot.setStyles({"opacity": 1, "display": "block"});
       
    21                     } else {
       
    22                         spot.setStyles({"opacity": 0, "display": "block"});
       
    23                         spot.tween("opacity", 1);
       
    24                     }
    23                     this.setStyle("display", "none");
    25                     this.setStyle("display", "none");
    24                     content.tween("opacity", 1);
       
    25                     (function() {
    26                     (function() {
    26                         content.setStyle("display", "none");
    27                         spot.setStyle("display", "none");
    27                         hotspot.setStyle("display", "block");
    28                         hotspot.setStyle("display", "block");
    28                     }).delay(12000);
    29                     }).delay(12000);
    29                 });
    30                 });
    30 
    31 
    31                 content.addEvent("click", function() {
    32                 spot.addEvent("click", function() {
    32                     this.setStyle("display", "none");
    33                     this.setStyle("display", "none");
    33                     $(this.get('id').replace("z", "x"))
    34                     $(this.get('id').substring(0, this.get('id').length-1))
    34                         .setStyle("display", "block");
    35                         .setStyle("display", "block");
    35                 });
    36                 });
    36             }
    37             }
    37         });
    38         });
    38     }).delay(100);
    39     }).delay(100);