Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown dynamic offset v4 #24204

Closed
romanlex opened this issue Oct 2, 2017 · 5 comments
Closed

Dropdown dynamic offset v4 #24204

romanlex opened this issue Oct 2, 2017 · 5 comments
Labels

Comments

@romanlex
Copy link
Contributor

romanlex commented Oct 2, 2017

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');
@romanlex romanlex changed the title Dropdown position dynamic offset v4 Dropdown offset dynamic offset v4 Oct 2, 2017
@romanlex romanlex changed the title Dropdown offset dynamic offset v4 Dropdown dynamic offset v4 Oct 2, 2017
@Johann-S
Copy link
Member

Johann-S commented Oct 2, 2017

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'
})

@romanlex
Copy link
Contributor Author

romanlex commented Oct 2, 2017

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

@Johann-S
Copy link
Member

Johann-S commented Oct 2, 2017

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

@romanlex
Copy link
Contributor Author

romanlex commented Oct 2, 2017

@Johann-S thx )) #24208

@Johann-S
Copy link
Member

Johann-S commented Oct 3, 2017

Related to : #24223

@Johann-S Johann-S closed this as completed Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants