[英]jQuery popup / hide box
這是我到目前為止的位置: http : //jsbin.com/ujuqa3/4
到目前為止,我已經決定在.share-box打開時將變量設置為false和true。 打開后,我希望用戶能夠單擊任何地方(框除外)將其關閉。
目前,它是第一次運行,但是此后的任何時間,由於某種原因,它都會混亂。
$(document).ready(function() {
// user clicks on report this button
$(".shareThis").click(function() {
// confirmation fades in
$(".share-box").fadeIn("fast"),
// Prevent events from getting pass .share-box
$(".share-box").click(function(e){
e.stopPropagation();
});
});
$(document.body).click(function () {
$("body").click(function(){
// hide the share-box if clicked anywhere aside from the box itself
$(".share-box").fadeOut().removeClass("active");
});
});
});
添加return false;
// user clicks on report this button
$(".shareThis").click(function() {
// confirmation fades in
$(".share-box").fadeIn(),
// Prevent events from getting pass .share-box
$(".share-box").click(function(e){
e.stopPropagation();
});
return false;
});
當$('。shareThis')單擊發生時,也會觸發$(document.body).click
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.