I have a few elements who's sizes are variable and I'm trying to move a button with them. My issue is that I don't want to have to hard code it for an unknown number of elements but the code doesn't seem to be working and I'm not sure why.
This is the script that is supposed to move the button
$("#closeButton").css(moveButton([200, 200]));
and this is the moveButton function
function moveButton(p1){
var a = (p1[0] + 20) + 'px';
var b = (p1[1] - 100) + 'px';
return '{"top": "' + a + '", "left": "' + b + '"}';
}