1
我試圖創建一個花哨的框和不幸的表單,即使它顯示輸入元素和正確的標記,單擊任何形式導致fancybox刷新。我錯過了什麼,以禁用點擊事件的泡沫,所以你可以實際進入一個文本輸入框或選擇形式的selectoptions沒有花哨的盒子刷新?FancyBox刷新每一次點擊
$(document).ready(function() {
var box = $("#show_mailing_list_signup");
box.fancybox({
'showCloseButton': true,
'scrolling': 'no',
'titleShow': false,
'beforeLoad': function() {
return !hideMailList();
},
'afterLoad': function() {
$('#disableSignup').click(function() {
setCookie("hideSignup", true, 365);
$.fancybox.close();
return false;
});
$("#send_form").click(function() {
return false;
});
}
}).click();
});
<div id="show_mailing_list_signup">
<form id="mailinglistForm" method="post">
<h2>Header</h2>
<label for="name">* Name </label>
<p>
<input name="fname" type="text" id="name" minlength="4" maxlength="15" />
</p>
<br />
<label for="email">* Email </label>
<p>
<input name="email" type="text" id="email" />
</p>
<br />
<label for="state">Pick your favorite school</label>
<p>
<select id="state">
<option>NY</option>
<option>IL</option>
</select>
<select id="city">
<option>Schenectedy</option>
<option>Fishkill</option>
</select>
</p>
<p>
<input id="schoolSearch" type="text"/>
</p>
<%--default to the most select school--%>
<p style="margin-top: 20px;">
<input value="Join Now" type="button" name="send_form" id="send_form" />
</p>
</form>
<p class="details">blah</p>
<a href="#" id="disableSignup">don't show again</a>
</div>