For what it's worth, I figured this out. I looked at the dynamic tooltip positioning code here:
http://flowplayer.org/tools/demos/tooltip/dynamic.htmland borrowed the getCropping and isVisible functions, modified them to work how I wanted and came up with this:
- $("#login_btn").click(function(e) {
- showing = document.getElementById("loginbox_showing").value ==1;
- // This tells me if the click happened in the right part of the button (with the arrow)
- var x = $(this).position().left+68;
- if (e.screenX >= x) {
- if(!showing) {
- var crop = getCropping($("#login_box"), $(this));
- if (!isVisible(crop)) {
- // set top left variables
- var top = $(this).position().top+12;
- var left = $(window).width() + $(window).scrollLeft()-$("#login_box").width()-35;
- } else {
- var top = $(this).position().top+12;
- var left = $(this).position().left;
- }
- document.getElementById("loginbox_showing").value = 1;
- $("#login_box").css('margin-left', left);
- $("#login_box").css('top', top);
- $("#login_box").slideDown();
- $("#login_box").css('z-index', '1000');
- $("#username").focus();
- $("#username").select();
- } else {
- document.getElementById("loginbox_showing").value = 0;
- $("#login_box").slideUp();
- } // if(!showing)
- } else {
- document.location = "login.php?mode=logon";
- } // if (e.screenX > 790)
- return false;
- });
Now, I've run into another problem. We have Flash banners and this goes behind them even with the z-index being set.
Anyone know how to fix that?
[Edit]
Fixed it with wmode parameters...