Skip to content

Instantly share code, notes, and snippets.

@valdiney
Created March 26, 2016 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valdiney/f0f9e29ac4f7b1eb3eb5 to your computer and use it in GitHub Desktop.
Save valdiney/f0f9e29ac4f7b1eb3eb5 to your computer and use it in GitHub Desktop.
function aplicaFiltro(filtro, slider, valor, unidade) {
var imagem = document.getElementById("meumapa");
var y = document.getElementById(slider);
var x = document.getElementById(valor);
x.value = y.value+unidade;
if('-webkit-filter' in document.body.style) {
imagem.style.webkitFilter = filtro+'('+y.value+unidade+')';
} else if ('filter' in document.body.style) {
imagem.style.filter = filtro+'('+y.value+unidade+')';
}
}
<input type="range" onchange="aplicaFiltro('brightness', 'rangeBrightness', 'valorBrightness', '%')" value="100" id="rangeBrightness" max="300" min="0">
<input type="text" size="2" value="100%" id="valorBrightness">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment