我正在设置一个页面,其中包含调暗页面部分的按钮。我修改了一些我在这里找到的代码:http://www.jankoatwarpspeed.com/use-jquery-to-turn-off-the-lights-while-watching-videos/点击打开和关闭CSS过滤器亮度
但是我在javascript/jQuery上很糟糕,我不确定如何让它做我需要的。
这里的脚本:
$(document).ready(function(){
$("#shadow").css("height", $(document).height()).hide();
$(".lightSwitcher").click(function(){
$("#shadow").toggle();
if ($("#shadow").is(":hidden"))
$(this).removeClass("turnedOff");
else
$(this).addClass("turnedOff");
});
});
而且这里有一个的jsfiddle:http://jsfiddle.net/e2b7dxa0/
我想它,以便在单击光开关在与“影子” ID什么变暗。现在,任何具有该ID的内容都会隐藏起来,直到单击灯开关并且我希望它可以看到,无论开关是否打开。我只想让开关切换CSS中的亮度过滤器。
另外,jQuery中有一些东西导致高度扩展到页面的高度,我想删除它。
的高度是因为'$(文件).height()' – hjpotter92