简体   繁体   中英

Polymer 1.0 - how to keep paper-dropdown-menu in the screen?

This is how my code looks like.

<div class="horizontal layout flex wrap center-justified">
  <paper-material elevation='1'>
    <div class='horizontal layout'> <span>Some Data</span> <span>
      <paper-icon-button icon='more-vert'></paper-icon-button>
      <paper-dropdown-menu>
        <paper-material id='drop-install'>
          <paper-menu>
            <paper-item id='paper-drop-item'>Tap1</paper-item>
            <paper-item id='paper-drop-item'>Tap2</paper-item>
            <paper-item id='paper-drop-item'>Tap3</paper-item>
          </paper-menu>
        </paper-material>
      </paper-dropdown-menu>
      </span> </div>
  </paper-material>
  <paper-material elevation='1'>
    <div class='horizontal layout'> <span>Some Data</span> <span>
      <paper-icon-button icon='more-vert'></paper-icon-button>
      <paper-dropdown-menu>
        <paper-material id='drop-install'>
          <paper-menu>
            <paper-item id='paper-drop-item'>Tap1</paper-item>
            <paper-item id='paper-drop-item'>Tap2</paper-item>
            <paper-item id='paper-drop-item'>Tap3</paper-item>
          </paper-menu>
        </paper-material>
      </paper-dropdown-menu>
      </span> </div>
  </paper-material>
</div>

图片1

I am sure everything works perfectly.

图片2

but, when I am tapping on the second paper-icon-button which is at right end of the screen, the paper-dropdown-menu leaves the display.

So, I want all paper-dropdown-menus to be inside of the screen. Please support me fixing this issue.

try using this styling:

.dropdown-content{
    position: fixed;
    right: 0px;
    }

on:

    <paper-menu-button class="flex-options">
        <paper-icon-button icon="more-vert" class="dropdown-trigger"></paper-icon-button>
            <paper-menu class="dropdown-content" attr-for-selected="data-route" selected="[[route]]">
                <paper-item class="item-hover">

I had the same problem, my content went off screen. this styling fixed the issue for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM