像这样的东西?
标记
<div class="left">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
<div class="right">
<div class="block">Result 1</div>
<div class="block">Result 2</div>
<div class="block">Result 3</div>
<div class="block">Result 4</div>
</div>
JS
$(function(){
$('.left > div').on('click', function(){
//Just show the respective block div based on the clicked index and hide its siblings that are visible.
$('.block').eq($(this).index()).show().siblings('.block:visible').hide();
});
});
演示
带一点幻灯片效果
$(function () {
$('.block').eq(0).show();
$('.left > div').on('click', function () {
var elemToShow = $('.block').eq($(this).index()); //Get the element to show
$('.block:visible').stop().slideUp(1000, function () { // slide up the visible block div
elemToShow.stop().slideDown(1000); // once the animation finishes shidedown the element to show
});
});
});
演示幻灯片效果
演示淡入淡出效果