2017-08-03 81 views
-3

我必须安排客户端标识,因为它显示在图像中,我试过但 没有得到完美的圈子,有任何模板可用于此?如何创建圆形图片库

enter image description here

+2

哪里像?你有什么尝试? – Justinas

+0

类似于http://jquer.in/wp-content/uploads/2013/12/Pop-Circle.jpg? – anu

+0

对不起,只是分享链接 –

回答

0

像这样的事情?

要计算一个圆上的一个点,你可以使用:

var x = Math.cos(point) * size; 
var y = Math.sin(point) * size; 

,然后它的价值或者循环像我一样下面,或正好在圈内手动计算点和硬编码的问题他们进来。

function getCircle(offset, size, point, circlesize) { 
 
    var x = Math.cos(point) * size; 
 
    var y = Math.sin(point) * size; 
 
    var $div = $('<div class="picturediv"></div>'); 
 
    var $wrap = $('<div class="wrap"></div>'); 
 
    $wrap.css({ 
 
    top: offset + 'px', 
 
    left: offset + 'px' 
 
    }); 
 
    
 
    
 
    $div.css({ 
 
    top: (size+x) + 'px', 
 
    left: (size+y) + 'px', 
 
    width: circlesize + 'px', 
 
    height: circlesize + 'px' 
 
    }); 
 
    $wrap.append($div); 
 
    $('#wrap').append($wrap) 
 
} 
 

 
for(var c=0;c<6;c++) { 
 
    getCircle(200, 100,c * 45,50); 
 
} 
 
for(var c=0;c<=10;c++) { 
 
    getCircle(100, 200,c * 25.7, 75); 
 
}
.picturediv { 
 
    width: 50px; 
 
    height: 50px; 
 
    background-color:black; 
 
    border: 1px solid red; 
 
    border-radius:50%; 
 
    position: absolute; 
 
    top: 0px; 
 
    left: 0px; 
 
    background-image: url(https://i.imgur.com/AilIzSF.jpg); 
 
    background-position: -219px -193px;; 
 
    background-repeat: no-repeat; 
 
    
 
} 
 
.wrap { 
 
    position: relative; 
 
    left: 0px; 
 
    left: 0px; 
 
} 
 
#wrap { 
 
    width:100%; 
 
    height: 100%; 
 
    background-color: gray; 
 
    position: relative; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div id="wrap"> 
 
    <div class="wrap"> 
 
    <div class="picturediv" style="width:120px;height:120px;left:265px;top:265px;"></div> 
 
    </div> 
 
</div>

+0

谢谢,让我尝试这个, –