JQuery UI Position: When Resizing a Window

http://jsfiddle.net/jqrmh/

$(".one").position({
        "my": "right top",
        "at": "right top",
        "of": $(".main"),
});

I need my window to still remain on the right when I resize the window ... I'm trying to use "collision": "fit fit" ..... it doesn't work

http://jsfiddle.net/jqrmh/

( http://wiki.jqueryui.com/w/page/12138026/Position )

+5
source share
1 answer

You can simply change position when resizing:

http://jsfiddle.net/jqrmh/4/

function moveit() {
    $(".one").position({
        "my": "right top",
        "at": "right top",
        "of": $(".main"),
        "collision": "fit fit"
    });
}

$(window).resize(function(){
   moveit(); 
});

moveit();

Alternatively, assuming there is no other reason, you cannot just use css:

positon:relative position:absolute. top:0; right:0.

http://jsfiddle.net/jqrmh/5/

+8

All Articles