qooxdoo - Centering Overlay Widget Instance over Grid Layout -


i have composite using grid layout ( qx.ui.layout.grid ).

however, have overlay image on grid layout.

i managed : (c composite, while this application )

c.setlayout(new qx.ui.layout.grid()); var img = new qx.ui.basic.image("myproject/test.png"); this.getroot().add(img, {left: 500, top: 10}); 

the image overlayed on grid layout successfully. however, want image centering @ center of screen ( x-axis , y-axis still required 10px top ), given application occupies whole browser screen.

tried :

  • {left: 50%} , can't run
  • {margin: auto}, image disappears

how can make changes ?

answer question in comments (for better code example rendering):

... var imgwidth = qx.util.resourcemanager.getinstance().getimagewidth("myproject/test.png"); var imgwidthpercentage = imgwidth/qx.bom.viewport.getwidth()*100; this.getroot().add(img, {left: (50-imgwidthpercentage)+"%", top: 10}); 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -