« Documentation Home

BrowserWindow.top

This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.

For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.

Description:

When specified as an item in a BrowserWindowProperties object, the top property specifies the desired top offset of a browser window.

When creating a browser window, if this property is not specified the browser's default top offset is used.

When updating a browser window, if this property is not specified the default behaviour is to leave the top offset unchanged.

Syntax:

unsigned long top

Example:

The following example creates a button on the browser toolbar. When the button is clicked, a new window is created with the specified height, width, top offset and left offset.

//
// The background process (e.g. index.html)
//

// Specify the properties of the button before creating it.
var UIItemProperties = {
  disabled: false,
  title: "Example extension",
  icon: "images/icon_18.png"
};

// Create the button and add it to the toolbar.
var button = opera.contexts.toolbar.createItem( UIItemProperties );  
opera.contexts.toolbar.addItem(button);

button.addEventListener('click', handleClick, false);

function handleClick() {
  // Set the properties for the window
  var windowProps = {
    height: 600,
    width: 400,
    top: 50,
    left: 100
  }
  
  // Create a new window using the specified properties
  opera.extension.windows.create({}, windowProps);
}