今天在項(xiàng)目到遇到一個(gè)select2插件在jquery UI Dialog 不能focus到搜索框的問題,后來在js 代碼中加入(位置可以自己選 ,我選的位置是select2.min.js 后面,因?yàn)楹芏嗟胤蕉加玫?,不用針?duì)一個(gè)一個(gè)功能去修改):
成都創(chuàng)新互聯(lián)公司主營(yíng)千陽網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都App定制開發(fā),千陽h5微信小程序定制開發(fā)搭建,千陽網(wǎng)站營(yíng)銷推廣歡迎千陽等地區(qū)企業(yè)咨詢
$.ui.dialog.prototype._allowInteraction = function(e) { return !!$(e.target).closest('.ui-dialog, .ui-datepicker, .select2-drop').length; };
出現(xiàn)這個(gè)問題的原因是:
the reason the dropdown is appended into the body and is the last element is so that it may overlay the dialog when the choice box is taller then the dialog instead of scrolling inside it.
initially select2 did append the dropdown to the container instead of body, but the afore mentioned problem with dialogs is what prompted me to refactor it to append to body in the first place. so far this proved to be a solution with the least amount of problems.
unfortunately its not a perfect solution, not when the dialogs are built with these weird restrictions in place.
這個(gè)原因來自:https://github.com/ivaynberg/select2/issues/1246
網(wǎng)頁名稱:Select2在jqueryUIDialog搜索項(xiàng)失效且不能focus到搜索框解決方案
轉(zhuǎn)載源于:http://www.rwnh.cn/article40/gpodho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、網(wǎng)站制作、小程序開發(fā)、軟件開發(fā)、網(wǎng)站改版、網(wǎng)站內(nèi)鏈
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)