我使用这个小提琴作为展示推荐的基础 - 所以当你点击链接时,相关推荐显示。
我面临的问题是我需要在页面加载时显示第一个推荐 - 此时用户必须单击链接才能显示推荐。
有谁知道我怎么能做到这一点?
小提琴:http: //jsfiddle.net/Fz44h/
<body>
<div id="menu_about">
<a class="link" href="#about" data-link="first"></a> •
<a class="link" href="#about" data-link="second">Testimonial 1</a> •
<a class="link" href="#about" data-link="third">Testimonial 2</a> •
<a class="link" href="#about" data-link="fourth">Testimonial 3</a> •
<a class="link" href="#about" data-link="fifth">Testimonial 4</a>
</div>
<div id="pages_about" class="textContainer_about">
<div class="textWord_about" data-link="first">
<p>Scelerisque arcu lorem porta? Porttitor ridiculus adipiscing diam nisi, turpis, aliquam tincidunt phasellus lundium! </p>
</div>
<div class="textWord_about" data-link="second">
<p>Lacus auctor dapibus. Placerat massa lundium lundium in, et. In lacus augue nisi? </p>
</div>
<div class="textWord_about" data-link="third">
<p>Placerat massa lundium lundium in, et. In lacus augue nisi?</p>
</div>
<div class="textWord_about" data-link="fourth">
<p>Scelerisque arcu lorem porta? Porttitor ridiculus adipiscing diam nisi, turpis, aliquam tincidunt phasellus lundium!</p>
</div>
<div class="textWord_about" data-link="fifth">
<p>Lacus auctor dapibus. Placerat massa lundium lundium in, et. In lacus augue nisi? </p>
</div>
</div>
<script type="text/javascript">
$('.textWord_about').hide();
$('.link').click(function() {
$('.textWord_about').hide();
$('.textWord_about[data-link=' + $(this).data('link') + ']').fadeIn({
width: '200px'
}, 300);
});
</script>