我使用ajax調用一些基本輸入元素(如a,輸入,標籤和按鈕)來加載JQmodal。我需要馬上開模焦點不工作的JQmodal
注後添加自定義類的重點內容:請使用tab鍵來關注每個元素
HTML
<p><a href="html_images.asp">HTML Images</a> is a link to a page on this website.</p>
<p><a href="http://www.w3.org/">W3C</a> is a link to a website on the World Wide Web.</p>
<a href="#" class="jqModal">view</a>
...
<div class="jqmWindow" id="dialog">
</div>
CSS:
.jqmWindow {
display: none;
position: fixed;
top: 17%;
left: 50%;
margin-left: -300px;
width: 600px;
background-color: #EEE;
color: #333;
border: 1px solid black;
padding: 12px;
}
.jqmOverlay { background-color: #000; }
/* Fixed posistioning emulation for IE6
Star selector used to hide definition from browsers other than IE6
For valid CSS, use a conditional include instead */
* html .jqmWindow {
position: absolute;
top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight)/100) + 'px');
}
*.focused
{
outline-width: 2px ;
outline-color: #282828;
outline-style: dotted;
}
Java腳本
$(document).ready(function() {
$('#dialog').jqm({ajax: 'https://raw.githubusercontent.com/jothikannan89/jqModal/ed84cf99ebe061e749e9774e64387ba7f/examples/ajax_tab.html'});
});
$("a,input,button,select,textarea,.jqmClose").on('focus',
function(event) {
event.preventDefault();
$(this).addClass('focused');
});
$("a,input,button,select,textarea,.jqmClose").on('blur',
function(event) {
event.preventDefault() ;
$(this).removeClass('focused');
});
我所得到的是怪異,重點類添加父頁面元素,但不會增加通過Ajax的模態,但默認焦點裝的元素正在
小提琴例如: Fiddle
我有一個關於模態和ajax對話框的焦點和Tab鍵問題的補丁:https://github.com/briceburg/jqModal/issues/29 –