Last active
April 11, 2019 01:29
-
-
Save ponsuke0531/f69c0f59b9fe66a4e63cd894194183f6 to your computer and use it in GitHub Desktop.
スクロールできるダイアログでbootstrap-selectを使ったらリストが画面からはみ出して選択できなくなった時の対応方法 ref: https://qiita.com/ponsuke0531/items/6e055428c33f7c644255
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<省略> | |
setSize: function () { | |
<省略> | |
} else if (this.options.size && this.options.size != 'auto' && menu.find('li' + notDisabled).length > this.options.size) { | |
var optIndex = this.$lis.not('.divider' + notDisabled).find(' > *').slice(0, this.options.size).last().parent().index(); | |
var divLength = this.$lis.slice(0, optIndex + 1).filter('.divider').length; | |
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding; | |
if (that.options.dropupAuto) { | |
//noinspection JSUnusedAssignment | |
this.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && (menuHeight < menu.height())); | |
} | |
menu.css({'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + 'px', 'overflow': 'hidden'}); | |
menuInner.css({'max-height': menuHeight - menuPadding + 'px', 'overflow-y': 'auto'}); | |
} | |
<省略> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<他は変更ないので省略> | |
<select id="dialogSelect" class="selectpicker"></select> | |
<他は変更ないので省略> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<他は変更ないので省略> | |
/** | |
* ダイアログのスタイル. | |
*/ | |
.modal-content { | |
width: 300px; | |
/* height: 120px; | |
overflow-y: scroll;*/ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<他は変更ないので省略> | |
/** | |
* ドロップダウンを作る. | |
*/ | |
function createDropdown() { | |
var options = { | |
size: 3 | |
}; | |
$('#dialogSelect').selectpicker(options); | |
} | |
<他は変更ないので省略> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment