我有一个背景图片和另一个作为指针的图片元素。因此,在代码段页面上方会看到3个选项卡。我的目标是在单击按钮时更改指针的位置。但存在一些问题,例如,如果您首先单击第2或第3个选项卡,则指针会向错误的方向移动。
而且,如果在第1个和第3个选项卡之间移动,则指针底部会移出黑色小圆圈。
如何在没有任何视觉错误的情况下实现我的目标?也许还有其他方法可以实现这一目标吗?
而且,如果在第1个和第3个选项卡之间移动,则指针底部会移出黑色小圆圈。
如何在没有任何视觉错误的情况下实现我的目标?也许还有其他方法可以实现这一目标吗?
function asama3() {
document.getElementById("ibre").style.transform = "rotate(-68deg)";
document.getElementById("ibre").style.left = "210px";
document.getElementById("ibre").style.top = "178px";
}
function asama2() {
document.getElementById("ibre").style.transform = "rotate(-107deg)";
document.getElementById("ibre").style.left = "157px";
document.getElementById("ibre").style.top = "180px";
}
function asama1() {
document.getElementById("ibre").style.transform = "rotate(-145deg)";
document.getElementById("ibre").style.left = "113px";
document.getElementById("ibre").style.top = "211px";
}
#ibre {
width:150px;
position: absolute;
left: 100px;
top: 258px;
transition: all 1s;
}
<div style="cursor: pointer; float:left; background-color:red; color:#fff; width:200px;"><h1 onclick="asama1()">1. aşama</h1></div>
<div style="cursor: pointer; float:left; background-color:red; color:#fff; width:200px;"><h1 onclick="asama2()">2. aşama</h1></div>
<div style="cursor: pointer; float:left; background-color:red; color:#fff; width:200px;"><h1 onclick="asama3()">3. aşama</h1></div>
<div style="clear:both;"></div>
<div style=" background-image: url('https://i.hizliresim.com/WNguZF.png'); background-repeat:no-repeat; height:281px; width:500px;">
<div style=""><img id="ibre" style="" src="https://i.hizliresim.com/Hmuavw.png"></div>
</div>