setPosition (left, top);
left. Left coordinate of the component;
top. The component top coordinate..
The setPosition method sets the position with the help of the drop-down panel.
The method is relevant if the left and top parameters are not set for the DropPanel.show method.
To execute the example, connect the PP.js library and the PP.css visual styles table. Locate the button on the HTML page and the panel opens on clicking the button:
<div id = "btn1"></div>
<script type="text/javascript">
var DP = new PP.Ui.DropPanel({
ParentNode: document.getElementById("DP1"),
Width: 200,
Height: 300})
function ShowPanel() {
DP.show(0,0);
DP.setPosition(200, 200);}
var btn = new PP.Ui.Button({
ParentNode: document.getElementById("btn1"),
Click: ShowPanel,
Content: Open})
</script>
After executing the example on clicking the button the panel expands. The panel is located at a distance of 200 pixels from the left and right page borders.
See also: