Change the coordinates of a div (absolute) dynamically

Hi all,

I try with the following script to change the top style property of a div but I have no effect. Perhaps I forget something ?

var fond = record.fields.FONDPAGE;
var y=results.css(“top”); /* the value of top is correct */
if (fond == “GOLD”){
y=“200px”;
}
results.css(“top”,y);

Thanks for your help.

Eric,

Hi Eric,

I assume you are working in the Print context. The coordinates of absolute positioned objects in the Print context are set via special attributes hence their relation to the page (e.g. paginated pages). The following sets the position via scripting.

results.attr('offset-x','96');
results.attr('offset-y','96');

The measurements are in pixels (e.g. 96px = 1in). Note that you do not need to set the units.

Hope this helps,

Erik

1 Like