javascript - What is more correct "setPosition" or "style.left/right"? -


i trying make mootools drag on iframe.

qestion:

is more correct use

var div = parent.document.getelementbyid("price_info"); div.setposition({ x: e.clientx-offx }); 

or

var div = parent.document.getelementbyid("price_info"); div.style.left = (e.clientx-offx) + 'px'; 

this info me fixing bigger problem... (here)

it comes down same thing. setposition() writes element's style object, manually.

i suppose if you've taken decision build code in framework should use api possible, unless there specific reason ignore , use vanilla js in place.

also, setposition() returns element(s) affected, whereas .style not, may factor regard chaining, example.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -