0
试图交换两个图像取决于用户点击。不能得到jQuery的切换功能工作
所以它应该隐藏用户刚刚点击过的图像并显示隐藏的图像。
必须在这里简单的东西错了......只要您指定的处理程序上.ready()
<!-- toggle for contrast buttons -->
<script type=text/javascript>
$("a.contrast-button").click(function() {
$("a.contrast-button").toggle();
});
</script>
<div class="span-16 last" id="access-controls">
<a class="contrast-button" id="switchDark" href="#"><img src="/static/images/contrast-dark.png" /></a>
<a class="contrast-button" id="switchRed" style="display:none;" href="#" ><img src="/static/images/contrast-light.png" /></a>
<a class="access-nav" href="#">contrast:</a>
</div>
我已经在小提琴中工作,但在实际页面中没有任何东西。我如何解决这个问题?我知道我打开萤火虫,但不知道我需要做什么。 – bytejunkie
刚刚看到您的编辑。我已经把js移到了页脚,在/ body标签之前,它仍然没有运行。 – bytejunkie
@shofty:首先使用浏览器的开发人员工具查找控制台中的错误。如果没有错误,那么在你没有发布的代码中肯定会出现一些问题。 – user113716