Reposition element to the bottom right of another element


// resize grid gaps onload and onresize
function reposition_popup(e, t)
{
var windowwidth = $( window ).width();
var windowheight = $( window ).height();
if (windowwidth < 480) { // small } else { // other } var offset = t.offset(); var height = t.height(); var width = t.width(); farright = offset.left + width - 40; // change this constant farbottom = offset.top + height - 40; // change this constant var popupheight = e.height(); var popupwidth = e.width(); newtop = farbottom - popupheight; newleft = farright - popupwidth; $( e ).css({ "position": "fixed", "top": newtop+'px', "left": newleft+'px' }); }