亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    怎么能在頁面上實現(xiàn)一個圓形可點擊區(qū)域?

    1. map+area

    DW軟件實現(xiàn)方法 視頻:

    2. border-radius(H5)

    1. <style>

    2. .circle{

    3. /*圓設(shè)置*/

    4. width:100px;

    5. height:100px;

    6. border-radius: 50%;

    7. cursor: pointer;

    8. /*文字設(shè)置*/

    9. position: absolute;

    10. left:50px;

    11. top:50px;

    12. line-height: 100px;

    13. text-align: center;

    14. color: white;

    15. background-color:dimgray;

    16. }

    17. </style>

    3. 純js實現(xiàn)

    求點在不在圓上的簡單算法、獲取鼠標坐標等等
    兩點之間的距離計算公式

    |AB|=Math.abs(Math.sqrt(Math.pow(X2-X1),2)+Math.pow(Y2-Y1,2)))

    假設(shè)圓心為(100,100),半徑為50,在圓內(nèi)點擊彈出相應的信息,在圓外顯示不在圓內(nèi)的信息

      1. document.onclick=function(e){

      2. var r=50;//圓的半徑

      3. var x1=100,y1=100,x2= e.clientX;y2= e.clientY;

      4. //計算鼠標點的位置與圓心的距離

      5. var len=Math.abs(Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2)));

      6. if(len<=50){

      7. console.log("內(nèi)")

      8. }else{

      9. console.log("外")

      10. }

      11. }

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號