3
I was able to move horizontally using buttons(),and the onlcik method , but when I try to do the same vertically using .style.bottom or .style.top and tried to change the increment but the position of my object does not change.
html :
<div id="caixa">
<div id="caixinha">
</div>
</div>
<br>
<div>
  <button onclick = "MovUp()">↑</button>
<br>
<button onclick="movimentoDireita()"> ← </button>
<button onclick="movBaixo">↓</button>
<button onclick="movimentoEsquerdo()"> →</button>
</div>
css :
#caixa{
width: 200px;
height: 200px;
background: green;
position: relative;
}
#caixinha{
width: 50px;
height: 50px;
background: red;
position: absolute;
}
js :
var posH = 0
var posL = 0
var caixinhafilha = document.getElementById("caixinha")
function MovUp(){
if(posH<=0){
caixinhafilha.style.top = posH + "px"
}else{
posH--
caixinhafilha.style.top = posH + "px"
}
}
function movBaixo(){
if(posH>=150){
caixinhafilha.style.bottom = posH + "px"
}else{
posH++
caixinhafilha.style.bottom= posH + "px"
}
}
now it’s working properly, thanks for helping Sam
– 0000FFcar
Cool! If solved, you can mark in the reply.
– Sam
@Leocaracciolo Coé!
– Sam
I forgot B A BA, I’m going back to the primary
– user60252
pera q has another
– user60252
that is it
$registro["idrole"] = $cur->fields["idrole"];
being$cur = $conn->execute($SQL);
– user60252
xiii, this is php kkkkk
– user60252
tah suffering from amnesia? rs
– Sam
how do I mark the answer?
– 0000FFcar