(^170) ❘ CHAPTER 6 CSS
if (contextMenu.outerWidth() > (vpx - event.pageX))
{
contextMenu.css('right', (vpx - event.pageX) + 'px');
}
else
{
contextMenu.css('left', event.pageX + 'px');
}
}
);
$('div#contextMenu').hover(
function()
{
contextMenuOn = true;
},
function()
{
contextMenuOn = false;
}
);
$(document).mousedown(
function()
{
if (!contextMenuOn)
{
$('div#contextMenu').hide();
}
}
);
}
);
The preceding example produces output similar to Figure 6-1.
elliott
(Elliott)
#1