patrick@17: // $Id$ patrick@17: // balade_nature patrick@17: patrick@17: var text = null; patrick@17: var spot = null; patrick@17: var box = null; patrick@17: var boxProperty = ''; patrick@17: patrick@17: patrick@17: window.addEvent('domready', function(){ Patrick@74: // Hotspots patrick@17: (function initialize() { Patrick@74: var scenario; Patrick@74: var content; Patrick@74: $$(".pdocHotspot").each(function(hotspot) { Patrick@74: scenario = hotspot.getElement("span"); Patrick@74: content = $(hotspot.get('id').replace("x", "z")) Patrick@74: if (scenario && content) { Patrick@74: Patrick@74: hotspot.addEvent("click", function() { Patrick@74: var content = $(this.get('id').replace("x", "z")); Patrick@74: content.setStyles({"opacity": 0, "display": "block"}); Patrick@74: this.setStyle("display", "none"); Patrick@74: content.tween("opacity", 1); Patrick@74: (function() { Patrick@74: content.setStyle("display", "none"); Patrick@74: hotspot.setStyle("display", "block"); Patrick@74: }).delay(12000); Patrick@74: }); patrick@17: Patrick@74: content.addEvent("click", function() { Patrick@74: this.setStyle("display", "none"); Patrick@74: $(this.get('id').replace("z", "x")) Patrick@74: .setStyle("display", "block"); Patrick@74: }); patrick@17: } patrick@17: }); Patrick@74: }).delay(100); patrick@17: patrick@17: // Effect: glow patrick@17: var effectGlow = $("effectGlow"); patrick@17: if (effectGlow) { patrick@17: text = $("effectGlowText"); patrick@17: spot = $("effectGlowSpot"); patrick@17: box = $("effectGlowBox") patrick@17: if (typeof box.style.webkitBoxShadow == 'string') { patrick@17: boxProperty = 'webkitBoxShadow'; patrick@17: } else if (typeof box.style.MozBoxShadow == 'string') { patrick@17: boxProperty = 'MozBoxShadow'; patrick@17: } else if (typeof box.style.boxShadow == 'string') { patrick@17: boxProperty = 'boxShadow'; patrick@17: } patrick@17: patrick@17: if (text && spot && box) { patrick@17: effectGlow.onmousemove = onMouseMove; patrick@17: effectGlow.ontouchmove = function (e) { patrick@17: e.preventDefault(); patrick@17: e.stopPropagation(); patrick@17: onMouseMove({clientX: e.touches[0].clientX, clientY: e.touches[0].clientY}); patrick@17: } patrick@17: } patrick@17: } patrick@17: }); patrick@17: patrick@17: patrick@17: function onMouseMove(e) { patrick@17: if (typeof e === 'undefined' || typeof e.clientX === 'undefined') { patrick@17: return; patrick@17: } patrick@17: patrick@17: var xm = (e.clientX - Math.floor(window.innerWidth / 2)) * 0.4; patrick@17: var ym = (e.clientY - Math.floor(window.innerHeight / 3)) * 0.4; patrick@17: var d = Math.round(Math.sqrt(xm*xm + ym*ym) / 5); patrick@17: text.style.textShadow = -xm + 'px ' + -ym + 'px ' + (d + 10) + 'px black'; patrick@17: patrick@17: if (boxProperty) { patrick@17: box.style[boxProperty] = '0 ' + -ym + 'px ' + (d + 30) + 'px black'; patrick@17: } patrick@17: patrick@17: xm = e.clientX - Math.floor(window.innerWidth / 2); patrick@17: ym = e.clientY - Math.floor(window.innerHeight / 2); patrick@17: spot.style.backgroundPosition = xm + 'px ' + ym + 'px'; patrick@17: } patrick@17: