我正在使用select2 library,现在,当我点击select2输入字段时,它会打开下拉列表,但我不想打开下拉列表,我想打开select2选项下拉列表在按键上,任何帮助都将是值得赞赏的。
这是我的代码:
share_users_select = $('#sharing-user-email').select2
tags: true,
placeholder: 'Enter Email Address',
selectOnClose: true,
closeOnSelect: false,
tokenSeparators: [',', ';', ' '],
templateSelection: format,
templateResult: format
createTag: (term, data) ->
value = term.term
if validateEmail(value)
return {
id: value
text: value
}
null
share_users_select.val("").trigger("change")
share_users_select.on 'select2:unselecting', (e) ->
$(this).data 'unselecting', true
disableShareButton()
share_users_select.on 'select2:opening', (e) ->
if $(this).data('unselecting')
$(this).removeData 'unselecting'
e.preventDefault()
setTimeout(getEmptyImagesForSelect2, 1500)
share_users_select.on 'select2:close', (e) ->
setTimeout(onCloseSelect2SetGravatar, 1000)
share_users_select.on 'select2:select', (e) ->
console.log 'select'
disableShareButton()
答案 0 :(得分:0)
初始化select2 on元素时,请在选项中设置body {
background-color: #F2EBE2;
}
.fullscreen {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
padding: 0;
}
.photo {
position: absolute;
cursor: pointer;
-webkit-transition: all 0.6s;
-moz-transition: all 0.6s;
transition: all 0.6s;
}
.side {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: transform 0.6s;
-moz-transition: transform 0.6s;
transition: transform 0.6s;
}
.side-back {
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
transform: rotateY(-180deg);
display: table;
}
.side-back div {
display: table-cell;
vertical-align: middle;
background-color: rgb(0, 0, 0);
}
.side-back p {
padding: 2px;
color: #d7551d;
font-family: Helvetica, Arial, sans-serif;
}
figure {
width: 150px;
position: absolute;
/* padding: 30px; */
margin: 0 auto;
text-align: center;
background-color: rgb(10, 10, 10);
}
figure img {
height: auto;
max-width: 100%;
margin: 0 auto;
/*margin-bottom: 15px;*/
}
figure img.zoomed{
position: fixed;
top: 5vh;
bottom: 5vh;
left: 5vw;
right: 5vw;
max-width: 90vw;
max-height: 90vh;
margin: auto;
border: 4px solid #000
}
figure figcaption {
font-family: Comic Sans, Comic Sans MS, cursive;
color: #f85a16;
font-size: 10px;
}
.navbar {
position: fixed;
bottom: 0;
width: 100%;
padding: 10px;
text-align: center;
background-color: black;
z-index: 999;
}
button {
background-color: transparent;
padding: 10px 24px;
color: #ffffff;
border: 2px solid black;
-webkit-transition-duration: 0.4s;
-moz-transition-duration: 0.4s;
transition-duration: 0.4s;
}
button:hover {
background-color: #a00;
color: white;
}
#copyright {
font-family: Consolas, Verdana, Arial, sans-serif;
position: fixed;
color: #ccc;
text-decoration: none;
bottom: 20px;
right: 10px;
}
#copyright:hover {
color: white;
text-decoration: none;
}
@media screen and (max-width: 767px) {
#forkme {
display: none;
}
#copyright {
position: relative;
display: block;
text-align: center;
right: 0px;
bottom: 0px;
}
}
。
minimumInputLength: 1
答案 1 :(得分:0)
我找到了一个解决方案,它可以按照我的需要工作, 只需要在' createTag'中添加一个条件功能
List<Character> array = new ArrayList<>();