将鼠标悬停在图像或< p>上时,需要更改图像的不透明度.它上面.这是html结构<div id="article-menu"><ul><p>Image</p><li><img src="..." /></li></ul> </div>jQuery的$("#article-menu img, #article-menu p").hover(function() {$(this).closest('img').css('opacity', 1); }, function() {$(this).closest('img').css('opacity', 0.7); });这是行不通的.仅当您将实际图像悬停在p元素上时,它才起作用.解决方法:仅CSS解决方案:#art...
我试图使用具有不透明度css属性的简单动画:$('#testAnimation').click(function (event) {if ($(this).css('opacity') == 0) {$('#animationTarget').animate({opacity: 1}, 'slow');} else {$('#animationTarget').animate({opacity: 0}, 'slow');} });第一次,元素被成功隐藏.但是当我第二次点击按钮时,$(this).css(‘opacity’)返回值“1”. 在浏览器中进行调试时明确表示不透明度为0. 有人可以解释这种行为吗?解决方法:您正在...
我创建了一种模态叠加,然后是叠加的内容..模态叠加具有不透明度设置并且它有效但叠加的内容也有不透明度…我认为它继承它…我真的不想要要对内容应用新类,有没有办法说只适用于 这是我的CSS.modal-overlay {position: fixed;z-index:100;top: 0px;left: 0px;height: 100%;width: 100%;background: #000000;display: none; }和我的jquery创建模型和内容var overlayLayer = $("<div id='office-location'></div>").addClass('modal-o...