views:

90

answers:

3

Hi all,

I'm trying to use the following code at my FF extension with no success:

$('#duck').position({
    of: '#zebra',
    my: "left top",
    at: "left top"
});

(the Position manual is at http://docs.jquery.com/UI/Position)

I also tried:

var doc = gBrowser.selectedBrowser.contentDocument;
$('#duck', doc).position({
    of: $('#zebra', doc),
    my: "left top",
    at: "left top"
});

Both without success.... on the other hand when I try the first code example at the web page code itself it work wonderfully...

Anyone got any idea what's causing the problem?

Cheers and thx in advance! Nimrod Yonatan Ben-Nes

A: 

use the position function like the following:

var position = $('selector').position();

var left = position.left;
var top = position.top;
XGreen
It does work (and indeed maybe I will be able to use that at the end) but I really prefer to use the new position method if it's possible.thx anyway :)
Nimrod Yonatan Ben-Nes
A: 

In all the examples at the link you provide, they only give the id selector at the of property. Not a jqueury object..

So .. have you tried

$('#duck').position({
    of: '#zebra',
    my: "left top",
    at: "left top"
});

notice that i use '#zebra' and not $('#zebra')

Gaby
You are totally right but I can't add the doc there like that... got any idea how can I do that? (it doesn't work like that as well)
Nimrod Yonatan Ben-Nes
A: 

sounds funny, but use double-quotes around the "left top" and "#duck" throughout. Also, be sure this is all been put within the $(document).ready function.

Billy