Log in

View Full Version : "Lights off" script



AlterPoser
05-28-2009, 06:03 PM
You know those buttons where you can click and it'll darken everything around a certain object (game, video) kinda like turning off the lights so you can better focus on playing a game or watching a movie. I tried looking around for one but I don't know what it's called.

Any help would be cool.

Nile
05-28-2009, 06:38 PM
In HTML or Flash?

AlterPoser
05-29-2009, 01:11 PM
In HTML or Flash?

HTML would be preferred. I don't really know much about flash but I want to darken around a flash application.

Kinda like THIS (http://www.youtube.com/watch?v=jB4xlYKAVCQ).

AlterPoser
05-30-2009, 07:58 PM
lol, nothing?

AlterPoser
06-03-2009, 05:08 PM
Okay so I went to Youtube and view sourced the page. I found this snippet but I have to clue what do do with it.


function toggleLights(lightsOff) {
if (lightsOff) {
addClass(document.body, 'watch-lights-off');
} else {
removeClass(document.body, 'watch-lights-off');
}

if (!lightsOff) {
hideDiv('watch-longform-shade');
} else {
_gel('watch-longform-shade').style.height = parseInt(_gel('baseDiv').offsetHeight) + 'px';
showDiv('watch-longform-shade');
}
}

onLoadFunctionList.push(function() {
addListener(document.body, 'click', function(e) {
stopPropagation(e);

var evt = e || window.event;
var target = evt.target || evt.srcElement;
if (!hasAncestor(target, 'watch-longform-buttons')) {
toggleLights(false);
}
});
});