javascript - need to divide circle image to 8 part, and put label on each part. pressing label will turn the circle to the divided part -


i have circle image (like roulette template), , need split 8, , put label on each part. when pressing on divided part, need circle point on correct part.

this jsfiddle of have in mean time: http://jsfiddle.net/eyalin/x8q9nqt1/

this js:

var img = document.queryselector('img'); img.addeventlistener('click', onclick, false);   function onclick() {     this.removeattribute('style');      var deg = 500 + math.round(math.random() * 500);      var css = '-webkit-transform: rotate(' + deg + 'deg);';      this.setattribute(         'style', css     ); } 

what need create image in photoshop dividers , use image map select dividers, use jquery select them. post image , image map code soon.

this example image, need create likings

then use image map generator

and result:

<img src="url/to/your/image.jpg" alt="" usemap="#map" /> <map name="map" id="map">     <area alt="" title="" href="#" shape="rect" coords="506,493,510,1017" />     <area alt="" title="" href="#" shape="poly" coords="901,833,519,496,518,503,895,839" />     <area alt="" title="" href="#" shape="poly" coords="499,499,139,848,132,842,495,493" />     <area alt="" title="" href="#" shape="poly" coords="492,495,12,502,13,491,493,488" />     <area alt="" title="" href="#" shape="poly" coords="152,174,500,478,492,484,146,183" />     <area alt="" title="" href="#" shape="poly" coords="498,21,502,473,512,474,507,20" />     <area alt="" title="" href="#" shape="poly" coords="853,156,515,479,522,484,859,163" />     <area alt="" title="" href="#" shape="poly" coords="1005,484,526,487,528,496,1003,494" /> </map> 

now can use jquery select different dividers , hook events them:

$('area').each(function() {     // }); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -