Positiong element ouside the viewable area of the website

Positiong element ouside the viewable area of the website

let's say we have a div.
it is visible all the time, it's not hidden, but let's say it's on the bottom of the page, so to see it we should scroll down the page.
the Task
to position a close button in that div.
the Problem:
.position doesn't position the close button where it should be if the div is not in the viewscope.
but if it is, it's positioned correctly.

  1. <fieldset id="generatedCode" class="smallBlock textAreaField"><span class="tooltip-s ui-icon ui-icon-circle-close" id="clearCode" title="clear"></span>
                <legend>License Code</legend>
                <textarea class="textAreaField ui-state-default ui-corner-all" readonly="" id="licenseCodeFull" name="licenseCodeFull"></textarea>
            </fieldset>




  1. $("#generatedCode").prepend('<span id="clearCode" title="clear" class="tooltip-s ui-icon ui-icon-circle-close"></span>');
            if($('#clearCode').length != 0){
                $('#clearCode').position({
                    of: $("#generatedCode"),
                    my: 'right top',
                    at: 'right top',
                    offset: '6 0'
                });
            }








p.s.
if i Hardcode the style attribute on the prepend element
position: relative; top: -22.4px; left: 288px;
the close button is position correctly,
Should i avoid the using the jquery positioning??