这是我正在使用的内容:
<script>
$(document).ready(function() {
$("#cf7_controls").on('click', 'span', function() {
$("#cf7 img").removeClass("opaque");
var newImage = $(this).index();
$("#cf7 img").eq(newImage).addClass("opaque");
$("#cf7_controls span").removeClass("selected");
$(this).addClass("selected");
});
});
</script> <div class="row">
<div class="span 6">
<div id="cf7" class="shadow">
<img class='opaque' src="/img/Cirques.jpg" />
<img src="/img/ClownFish.jpg" />
<img src="/img/Stones.jpg" />
<img src="/img/Summit.jpg" />
</div>
<p id="cf7_controls">
<span class="selected">Image 1</span>
<span>Image 2</span>
<span>Image 3</span>
<span>Image 4</span>
</p>
</div>
<div class="span 6">
<div id="cf7" class="shadow">
<img class='opaque' src="img/Cirques.jpg" />
<img src="img/ClownFish.jpg" />
<img src="img/Stones.jpg" />
<img src="img/Summit.jpg" />
</div>
<p id="cf7_controls">
<span class="selected">Image 1</span>
<span>Image 2</span>
<span>Image 3</span>
<span>Image 4</span>
</p>
</div>
我从http://css3.bradshawenterprises.com/cfimg/#cfimg7中提取了这段代码
不幸的是,它不能正常工作。可以在http://marc-with-ac.com上查看我的 WIP 的现场演示
谷歌浏览器中的错误是: Uncaught ReferenceError: $ is not defined marc-with-ac.com/:97
感谢您的帮助!