mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
Fix some issues with dropdown positioning
This commit is contained in:
parent
d1d33cba44
commit
95472a5d65
|
@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix error when sorting discussions by "oldest" (#627)
|
- Fix error when sorting discussions by "oldest" (#627)
|
||||||
|
- Fix some issues with dropdown positioning
|
||||||
|
|
||||||
## [0.1.0-beta.4] - 2015-11-05
|
## [0.1.0-beta.4] - 2015-11-05
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -47,7 +47,9 @@ export default class Dropdown extends Component {
|
||||||
// bottom of the viewport. If it does, we will apply class to make it show
|
// bottom of the viewport. If it does, we will apply class to make it show
|
||||||
// above the toggle button instead of below it.
|
// above the toggle button instead of below it.
|
||||||
this.$().on('shown.bs.dropdown', () => {
|
this.$().on('shown.bs.dropdown', () => {
|
||||||
const $menu = this.$('.Dropdown-menu').removeClass('Dropdown-menu--top Dropdown-menu--right');
|
const $menu = this.$('.Dropdown-menu');
|
||||||
|
const isRight = $menu.hasClass('Dropdown-menu--right');
|
||||||
|
$menu.removeClass('Dropdown-menu--top Dropdown-menu--right');
|
||||||
|
|
||||||
$menu.toggleClass(
|
$menu.toggleClass(
|
||||||
'Dropdown-menu--top',
|
'Dropdown-menu--top',
|
||||||
|
@ -56,7 +58,7 @@ export default class Dropdown extends Component {
|
||||||
|
|
||||||
$menu.toggleClass(
|
$menu.toggleClass(
|
||||||
'Dropdown-menu--right',
|
'Dropdown-menu--right',
|
||||||
$menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width()
|
isRight || $menu.offset().left + $menu.width() > $(window).scrollLeft() + $(window).width()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.props.onshow) {
|
if (this.props.onshow) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user