Skip to content

Dropdown dynamic offset v4 #24204

Closed
Closed

Description

@romanlex

Hello. I'm trying change dynamically position of the dropdown menu. My code is not work ((( How I can calculate and change position of dropdown dynamically before dropdown is showing?
Example, I trying change data attr of element data-offset on show.bs.dropdown or shown.bs.dropdown

this.$parentUl.siblings('.dropdown-toggle').attr('data-offset', '-100').data('offset', -100);
this.$parentUl.siblings('.dropdown-toggle').dropdown('update');

Activity

  1. changed the title [-]Dropdown position dynamic offset v4[/-] [+]Dropdown offset dynamic offset v4[/+] on Oct 2, 2017
  2. changed the title [-]Dropdown offset dynamic offset v4[/-] [+]Dropdown dynamic offset v4[/+] on Oct 2, 2017
  3. Johann-S commented on Oct 2, 2017

    @Johann-S
    Member

    Popper.js already handle that for you 👍

    EDIT:

    Hmm sorry I misunderstood your question @romanlex, I'm not sure if Popper.js handle to change the offset dynamicly, maybe a simple you can try :

    this.$parentUl.siblings('.dropdown-toggle').dropdown('dispose').dropdown({
      offset: '-100'
    })
  4. added
    jsJavaScript or TypeScript sources and plugins
    v4v4, the frozen docs on gh-pages
    on Oct 2, 2017
  5. romanlex commented on Oct 2, 2017

    @romanlex
    ContributorAuthor

    I found what I can send fn function in offset to Popper
    image
    But in source code (dropdown.js) I see only static offset for initialize plugin in modifiers
    image

  6. Johann-S commented on Oct 2, 2017

    @Johann-S
    Member

    that's true currently we only accept : number | string but we are open for a PR 😄

  7. romanlex commented on Oct 2, 2017

    @romanlex
    ContributorAuthor
  8. Johann-S commented on Oct 3, 2017

    @Johann-S
    Member

    Related to : #24223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsJavaScript or TypeScript sources and pluginsv4v4, the frozen docs on gh-pages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions