Div / CSS position not updating after javascript processing

I want to move the div, which usually floats on the right side to the absolute position (defined by js), and then returns to its original position.

The first part already works and relies on the installation of "style." for an object .. something like

mytarget.style.position="absolute";
mytarget.style.top="50px";

To move it back, I would just assign a standard class to an element that will also contain location information.

Oddly enough, everything except repositioning will work. Here is the relevant code:

var mytarget= document.getElementById(titlebarid);
var newclass=tabstyleclasses[titlebarid][ismaxedtab[titlebarid]];



mytarget.className= newclass ;

Debug:

 alert ("wanting to set : " + newclass  )    ;

This displays the correct value. ("Adfieldtitlesm")

alert ("my target is " +mytarget.id);

It also works.

alert ("new class is " + mytarget.className );

Gives the correct value. ("Adfieldtitlesm")

alert ("new position is " + mytarget.style.position );

Returns "absolute" (as previously set by JS when moving mytarget), should be "fixed"

This is the CSS class:

.adfieldtitlesm
 {
  position: fixed;
 top: 200px;
 left: 50px;

 font-size: 50px;
 background-color: #000000;
 color: #ffffff;

 }

, ?

UPDATE:

270-297 ( 290-294) rebuildtabs() , 160-183 minwidget() :)

+3
1

inline , .

mytarget.style.position="";

fixed, , .

, , :

delete mytarget.style.position;

, .

+4

Source: https://habr.com/ru/post/1788619/


All Articles