javascript - css property not apply properly [bottom,right] -
i create div
, in javascript
, after push google map
attach css
properties div
properties applied except 1 property bottom
specify value of 15px
shows 0px
. thoughts how apply that.
demo here
this how create div
var unitcontroldiv = document.createelement('div'); unitcontroldiv.style.margin = '4px'; unitcontroldiv.style.padding = '4px'; unitcontroldiv.style.backgroundcolor = 'buttonshadow'; unitcontroldiv.style.borderradius = '10px'; unitcontroldiv.style.bottom = '15px'; unitcontroldiv.style.right = '10px'; unitcontroldiv.classname = 'unitcontainer';
update 1
following css generated after map load
i want change above bottom
, right
0
,320px
15px
,10px
respectively
the problem line:
map.controls[google.maps.controlposition.bottom_right].push(unitcontroldiv);
this line resetting bottom css property '0px' because positioning controls bottom. workaround problem can use margin bottom.
unitcontroldiv.style.marginbottom = '50px';
---- updated ------
so why don't override in css itself...
.unitcontainer { margin:4px; padding:4px; background-color:buttonshadow; border-radius:10px; bottom: 50px !important; /*changed here*/ }
Comments
Post a Comment