Positioning a tooltip relative to various kinds of elements I am trying to simplify the following massive conditional statement but have no idea how to. Does anyone have suggestions for it?

//regular elements use the normal position variables.
var tooltipXPos = xPos;
var tooltipYPos = yPos-$tooltipElement.height()-YOffset;


//individual elements position shifting...
//for sub_link on top
if ($element.is('#uilder') || $element.is('#options')) {
    tooltipYPos = yPos + 35; 
}

//expend button after do search in Search page
if ($element.is('#extend')) {
    tooltipXPos = xPos - 240; 
}
if ($element.is('#lis')) {
     tooltipXPos = xPos - 295; 
     tooltipYPos = yPos - 80; 
}  


if ($element.is('#count')) {
    tooltipXPos = xPos + 180; 
    tooltipYPos = yPos - 90; 
}  
if ($element.is('label')) {
    tooltipXPos = xPos + 80; 
    tooltipYPos = yPos - 90; 
} 


if ($element.is('#add')) {
    tooltipXPos = xPos -280; 
    tooltipYPos = yPos -120; 
}


if ($element.is('title_label')) {
    tooltipXPos = xPos + 35; 
    tooltipYPos = yPos -75; 
}

//assign homework by class button under homework tab.. 
if ($element.is('#control')) {
    tooltipXPos = xPos -270; 
}

//place the tutorial window
$tooltipElement.css({
    position: 'absolute',
    top: tooltipYPos,
    left: tooltipXPos, 
    'z-index': 9999
})
Create an array which contains : 


the id of element
the offset x
the offset y 


then, loop on each element of this array and do a single if.

Something like that (not tested)

var items = [
    {name: '#te_classbuilder', x: -120, y: -0},
    {name: '#lesson-details-extend-button', x: 0, y: 120},
    {name: 'label', x: 100, y: -120}
];

for (var i = 0; i &lt; items.length; i++) {

  var item = items[i];

  if ($element.is(items[i].name) {
    tooltipXPos = xPos + item.x; 
    tooltipYPos = yPos + item.y;
  }
}


If you know the key, use a map and don't use a loop in the array, simply get the item of the map using the key.