# HG changeset patch # User Patrick PIERRE # Date 1366698679 -7200 # Node ID d8344a68c91fd4ad50c57dee3fb77d09e958dfdb # Parent a36f61911d60bc6d35fb129b9910e74dcddf22ec Nouveaux hotspots diff -r a36f61911d60 -r d8344a68c91f Pdf/BaladeNature/Js/balade_nature.js --- a/Pdf/BaladeNature/Js/balade_nature.js mar. avril 16 12:31:08 2013 +0200 +++ b/Pdf/BaladeNature/Js/balade_nature.js mar. avril 23 08:31:19 2013 +0200 @@ -10,27 +10,28 @@ window.addEvent('domready', function(){ // Hotspots (function initialize() { - var scenario; - var content; $$(".pdocHotspot").each(function(hotspot) { - scenario = hotspot.getElement("span"); - content = $(hotspot.get('id').replace("x", "z")) - if (scenario && content) { - + var spot = $(hotspot.get('id') + "s") + var scenario = hotspot.getElement("span"); + if (spot && scenario) { hotspot.addEvent("click", function() { - var content = $(this.get('id').replace("x", "z")); - content.setStyles({"opacity": 0, "display": "block"}); + var spot = $(this.get('id') + "s"); + if (spot.getChildren("img")) { + spot.setStyles({"opacity": 1, "display": "block"}); + } else { + spot.setStyles({"opacity": 0, "display": "block"}); + spot.tween("opacity", 1); + } this.setStyle("display", "none"); - content.tween("opacity", 1); (function() { - content.setStyle("display", "none"); + spot.setStyle("display", "none"); hotspot.setStyle("display", "block"); }).delay(12000); }); - content.addEvent("click", function() { + spot.addEvent("click", function() { this.setStyle("display", "none"); - $(this.get('id').replace("z", "x")) + $(this.get('id').substring(0, this.get('id').length-1)) .setStyle("display", "block"); }); }