Rumah  >  Soal Jawab  >  teks badan

Jejari sempadan: 50% tidak berfungsi |

Maksudnya di sini adalah untuk menetapkan kedudukan div pada tetikus sebagai kesan tambahan, ia sepatutnya mempunyai jejari, tetapi ia tidak berfungsi:

let inner_circle = document.getElementById("inner_circle");

window.addEventListener("mousemove", function(mouse) {
  inner_circle.style.transform = `translate(${mouse.clientX}px, ${mouse.clientY}px)`; // sets the position of the inner circle to the mouse
});
#inner_circle{
    margin-left: -3px;
    margin-top: -3px;
    position: fixed;
    top: 0;
    left: 0;
    border: 1px solid #703be7;
    border-radius: 50%; //<- doesn't work
    font-size: 1px;
    background-color: #703be7;
    width: 6px;
    width: 6px;
    z-index: 1000001;
    pointer-events: none;
}
<div id="inner_circle"></div>

P粉462328904P粉462328904205 hari yang lalu397

membalas semua(2)saya akan balas

  • P粉107991030

    P粉1079910302024-04-01 12:09:34

    Tukar CSS anda. Lebar: 6px; Lebar: 6px;

    let inner_circle = document.getElementById("inner_circle");
    
    window.addEventListener("mousemove", function(mouse) {
      inner_circle.style.transform = `translate(${mouse.clientX}px, ${mouse.clientY}px)`; // sets the position of the inner circle to the mouse
    });
    #inner_circle{
        margin-left: -3px;
        margin-top: -3px;
        position: fixed;
        top: 0;
        left: 0;
        border: 1px solid #703be7;
        border-radius: 50%; //<- doesn't work
        font-size: 1px;
        background-color: #703be7;
        width: 6px;
        height: 6px;
        z-index: 1000001;
        pointer-events: none;
    }
    sssccc
    

    balas
    0
  • P粉125450549

    P粉1254505492024-04-01 10:44:17

    Saya mengandaikan anda merujuk kepada ketinggian baris kedua di sini, yang menjadikannya masalah

    #inner_circle{
    width: 6px;
    width: 6px;
    }

    Jadi cuma tukar kepada ketinggian:

    #inner_circle{
    width: 6px;
    height: 6px;
    }

    balas
    0
  • Batalbalas