https://docs.google.com/document/d/1b2PZ-sGfikUnfXS3EB_8dw0HnmHUompYCvRyS2pKja8/editjQuery的彈出背景顏色
我附上我的彈出截圖... 如何讓背景色灰... 彈出後面的區域 http://jsfiddle.net/nVZEB/19/
我提供在彈出的jQuery代碼如下
$(function() {
var popup = false;
$(".open").click(function(){
if(popup === false){
$("#overlayEffect").fadeIn("slow");
$(this).parent().find('.popupContainer').fadeIn("slow");
$(this).parent().find('.close').fadeIn("slow");
center();
popup = true;
}
});
$(".close").click(function(){
hidePopup();
});
$(".overlayEffect").click(function(){
hidePopup();
});
function center(){
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $(".popupContainer").height();
var popupWidth = $(".popupContainer").width();
$(".popupContainer").css({
"position": "absolute",
"top": 85,
"left": windowWidth/2-popupWidth/2
});
}
function hidePopup(){
if(popup===true){
$(".overlayEffect").fadeOut("slow");
$(".popupContainer").fadeOut("slow");
$(".close").fadeOut("slow");
popup = false;
}
}
} ,jQuery);
你爲什麼要將'jQuery'作爲第二個參數傳遞給第一個'jQuery'(顯式爲'$')? – NicoSantangelo