jQuery: The Write Less, Do More JavaScript Library

Getting position of link parent in table

View: New views
1 Messages — Rating Filter:   Alert me  

Getting position of link parent in table

by tony stamp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I have one anchor link per row in my table's td's with a css class of .viewLink, and have attached a simple event to display a div with the contents from an ajax request. Now i am trying to align the popup with the position of the link, or row at least.

Here is the code i have so far.

$(document).ready(function(){
                $("#viewDetailsTable .viewLink").each(function(){
                        $(this).mouseover(function(){
                                $.ajax({
                                        type: "GET",
                                        url: this.href,
                                        data: "format=html",
                                        success: function(response){
                                                                        //var td = $(this).parent().position();
                                                                        //alert(td.top);
                                                                       
                                                                        $("#popUp").empty();
                                                                        $("#popUp").append(response);
                                                                        $("#popUp").fadeIn("slow");
                                                                }
                                });
                       
                        $(this).mouseout(function(){
                                $("#popUp").fadeOut("slow");
                        });
                       
                                return false;
                        })
                });
        });

I have tried:
var td = $(this).parent().position();
alert(td.top);

(as commented out above)
..but it doesn't work. How can i get the position of the link in the table (in pixels, so i can set the style of the pop-up).