I'm trying to implement Paulo's answer from: http://stackoverflow.com/questions/758906/how-would-i-implement-stackoverflows-hovering-dialogs.
However, my variable "err" keeps evaluating to "NULL".
The problem is with the line .css('left', element.position.left);
When I include it, err = NULL. When I take it out, err = an object with the necessary properties. But I need this CSS statement.
(by the way I changed all my $ references to jQuery in response to the advice below.)
Here's my code:
jQuery('.member-only').click(function() {
var element = jQuery(this);
jQuery.ajax({
type: 'POST',
url: '/ajax/member',
dataType: 'json',
success: function(data)
{
var err = jQuery('<div></div>')
.addClass('member-check')
.append(data.msg)
.css('left', element.position.left);
if (!(data.SignedIn)) // not signed in
{
element.after(err);
err.fadeIn('fast');
}
// otherwise just continue
}
});
jQuery('.member-check').live('click', function(){
element.fadeOut('fast', function() {element.remove(); });
});
});
Thanks.