Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Makes dynamic sizing of core-dropdown possible #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core-dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,24 @@
var target = this.target;
// remember position, because core-overlay may have set the property
var pos = target.style.position;
var width = target.style.width;
var height = target.style.height;

// get the size of the target as if it's positioned in the top left
// corner of the screen
target.style.position = 'fixed';
target.style.left = '0px';
target.style.top = '0px';
target.style.width = null;
target.style.height = null;

var rect = target.getBoundingClientRect();

target.style.position = pos;
target.style.left = null;
target.style.top = null;
target.style.width = width;
target.style.height = height;

return rect;
},
Expand Down