I'm having difficulty developing when we talk about for ... The basics I can understand now in practice ... People have developed this code and I believe it can be reduced to a few lines with.
Notice that in the input range change it appears different buttons (the ones determined) and closes the open button divs. When we press these buttons he opens his div and closes the others.
If necessary, please provide the simplified code below!
Here begins Js
/* Dinâmica do Input Range */
function updateTextInput(val) {
/* Para controlar os Botões */
if(val == 1){
document.getElementById('um').style.display = "block";
document.getElementById('dois').style.display = "block";
document.getElementById('tres').style.display = "none";
document.getElementById('quatro').style.display = "none";
document.getElementById('cinco').style.display = "none";
}
if(val == 2){
document.getElementById('um').style.display = "block";
document.getElementById('dois').style.display = "block";
document.getElementById('tres').style.display = "block";
document.getElementById('quatro').style.display = "none";
document.getElementById('cinco').style.display = "none";
}
if(val == 3){
document.getElementById('um').style.display = "block";
document.getElementById('dois').style.display = "block";
document.getElementById('tres').style.display = "block";
document.getElementById('quatro').style.display = "block";
document.getElementById('cinco').style.display = "none";
}
if(val == 4){
document.getElementById('um').style.display = "block";
document.getElementById('dois').style.display = "block";
document.getElementById('tres').style.display = "block";
document.getElementById('quatro').style.display = "block";
document.getElementById('cinco').style.display = "block";
}
/* Para controlar as Slide's Div */
document.getElementById('slideum').style.display = "none";
document.getElementById('slidedois').style.display = "none";
document.getElementById('slidetres').style.display = "none";
document.getElementById('slidequatro').style.display = "none";
document.getElementById('slidecinco').style.display = "none";
}
/* Dinâmica do Input Button */
function slideumf(){
document.getElementById('slideum').style.display = "block";
document.getElementById('slidedois').style.display = "none";
document.getElementById('slidetres').style.display = "none";
document.getElementById('slidequatro').style.display = "none";
document.getElementById('slidecinco').style.display = "none";
}
function slidedoisf(){
document.getElementById('slideum').style.display = "none";
document.getElementById('slidedois').style.display = "block";
document.getElementById('slidetres').style.display = "none";
document.getElementById('slidequatro').style.display = "none";
document.getElementById('slidecinco').style.display = "none";
}
function slidetresf(){
document.getElementById('slideum').style.display = "none";
document.getElementById('slidedois').style.display = "none";
document.getElementById('slidetres').style.display = "block";
document.getElementById('slidequatro').style.display = "none";
document.getElementById('slidecinco').style.display = "none";
}
function slidequatrof(){
document.getElementById('slideum').style.display = "none";
document.getElementById('slidedois').style.display = "none";
document.getElementById('slidetres').style.display = "none";
document.getElementById('slidequatro').style.display = "block";
document.getElementById('slidecinco').style.display = "none";
}
function slidecincof(){
document.getElementById('slideum').style.display = "none";
document.getElementById('slidedois').style.display = "none";
document.getElementById('slidetres').style.display = "none";
document.getElementById('slidequatro').style.display = "none";
document.getElementById('slidecinco').style.display = "block";
}
</script>
Here begins CSS
/* Style Inicial dos Inputs Button */
#um{display: none;}
#dois{display: none;}
#tres{display: none;}
#quatro{display: none;}
#cinco{display: none;}
/* Style Inicial das Div's dos Slides */
#slideum{display: none;}
#slidedois{display: none;}
#slidetres{display: none;}
#slidequatro{display: none;}
#slidecinco{display: none;}
</style>
</head>
Here begins HTML5
<input type="range" name="rangeInput" min="1" max="4" onchange="updateTextInput(this.value);">
<input id="um" type="button" value="1º Slide" onclick="slideumf()">
<div id="slideum">
<input type="range" min="1" max="5"><div id="slideum">1º Slide</div>
<input id="dois" type="button" value="2º Slide" onclick="slidedoisf()">
<div id="slidedois">2º Slide</div>
<input id="tres" type="button" value="3º Slide" onclick="slidetresf()">
<div id="slidetres">3º Slide</div>
<input id="quatro" type="button" value="4º Slide" onclick="slidequatrof()">
<div id="slidequatro">4º Slide</div>
<input id="cinco" type="button" value="5º Slide" onclick="slidecincof()">
<div id="slidecinco">5º Slide</div>
</body>