Trying to do some logic to ensure tooltips show within the viewable area. How can I use my flot_position variable within my .css() shown below?
//tooltip stuff
function showTooltip(x, y, contents) {
var window_width = $( window ).width();
if( x > (window_width - 60) )
{
var flot_position = 'right';
}
else
{
var flot_position = 'left';
}
$('<div id="tooltip">' + contents + '</div>').css({
position: 'absolute',
display: 'none',
top: y + 5,
flot_position: x + 15, // This doesn't set 'left' or 'right' to x+15
border: '1px solid #333',
padding: '4px',
color: '#fff',
'border-radius': '3px',
'background-color': '#333',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
flot_position, not a property calledleftorright. The error would be that the tooltip doesn't end up in the right place.