在Safari中使用Webkit的CSS3; 我有一个按钮,当点击时,会导致div淡入.这个div只是一个大的填充矩形,里面有几个按钮,其中一个按钮可以淡出相同的div.
问题是:当元素淡出(不透明度:0),然后单击其中一个按钮所在的位置时,onClick仍然被触发.换句话说,即使无法看到按钮(不透明度:0),它仍然存在并且是事件模型的一部分.我不希望这样.
按钮调用以下功能:
// This displays the overlay (popup)
function showCategoryPopup() {
// Was playing with the following, but with no success.
// popupCategory.style.display = "block";
// popupCategory.style.visibility = "visible";
// Change the attributes that will be animated.
popupCategory.style.opacity = 1;
popupCategory.style.webkitTransform = "scale(1.0)";
}
function hideCategoryPopup() {
// Change the animated attributes
popupCategory.style.opacity = 0;
popupCategory.style.webkitTransform = "scale(0.7)";
// Even if opacity is 0, we still get mouse events. So, make it hidden?
// popupCategory.style.visibility = "hidden";
// …Run Code Online (Sandbox Code Playgroud)