I'm trying to change the background position of an element using a checkbox, but is not working.
You can see the file here: http://ift.tt/2hWwSuq
Here is the code:
<div id="checkboz" class="checkbox">
<label for="modlgn-remember"><input id="modlgn-remember" name="remember" class="inputbox" value="yes" type="checkbox">Recordarme</label>
</div>
JS:
x=false;
function Check(){
if(x){
document.getElementById("checkboz").style.backgroundPosition='0 0';
document.getElementById("checkboz").style.backgroundPosition='-28px 0';
x=false;
}
else{
document.getElementById("checkboz").style.backgroundPosition='none';
document.getElementById("checkboz").style.backgroundPosition='0 0';
x=true;
}
}
CSS:
#checkboz{background: url(http://ift.tt/2i2lMRP);
background-size: 55px;
background-repeat: no-repeat;
width: 28px;
height: 28px;}
Thank you so much for your help :)
Aucun commentaire:
Enregistrer un commentaire