FancyBox正在关闭表单焦点,只打开表单内容



我有一个带有textarea、几个input和一个submit的表单。fancybox会完美打开,但当我单击任何一个字段进行聚焦时,该框会立即关闭,然后只打开表单内容。由于新框只包含表单,如果我试图集中注意力,同样的事情会再次发生,再次只打开表单。

HTML表单:

<form>
<fieldset class="profile">
<legend>Email John Doe:</legend>
<!-- PASS NAME (to query email) to the script -->
<input type="hidden" name="who" value="John Doe" />
<label for="from">Your Email:</label><br />
<input type="email" id="from" name="from" /><br />
<label for="message">Message:</label><br />
<textarea id="message" name="message" rows="4"></textarea>
<input type="submit" value="Send Email" />
</fieldset>
</form>

jQuery:

$(document).ready(function() {
    $('.profile').fancybox({
        closeClick  : false
    });
});

我以前和fancybox合作过,但这让我完全不知所措。我确信我错过了一些愚蠢的东西,但我不知道那个愚蠢的东西是什么。

附言:我不确定它是否相关,但内容是通过ajax加载的。

我认为罪魁祸首是绑定到fancybox的<fieldset class="profile">,所以尝试获取focus(点击)也会影响fieldset标签,它会一次又一次地触发fancybox。

使用其他类来触发fancybox或更改fieldset标记的类。

最新更新