vendredi 27 février 2015

Dispose some forms all around another form [some code already given]

The idea I want to realize is that :


search bars around one


those are searchbars made like this (not necessary)



<form action="/index" class="form-wrapper cf">
<input type="text" placeholder="Search here..." name="searchbox" >
<button class="searchbutton" type="submit">Search</button>
</form>


So i want to dispose them in a circle


the result would be similar to what you see here by clicking inside the "share" button.


I've found also this questions , but I cannot make them work


for example Stack question1


but I want only to put my form around and nothing more, like the 1st image


someone could help me, maybe just modifying a bit the answer code of the question I linked, that is:



var radius = 200; // radius of the circle
var fields = $('.field'),
container = $('#container'),
width = container.width(),
height = container.height(),
angle = 0,
step = (2*Math.PI) / fields.length;
fields.each(function() {
var x = Math.round(width/2 + radius * Math.cos(angle) - $(this).width()/2),
y = Math.round(height/2 + radius * Math.sin(angle) - $(this).height()/2);
$(this).css({
left: x + 'px',
top: y + 'px'
});
angle += step;
});


Also just some tips would be very usefull, I have all day to dispose them, so i will be here trying and maybe good will be created, then I will post my results for everyone who need.


Thank you in advance, if something not clear just comment, a question up would be helpful


Aucun commentaire:

Enregistrer un commentaire