我想在我的主页中显示前两个部分,然后当用户单击“显示更多新闻”时,前两个新闻消失了,而我隐藏的另外两个出现了。是否可以使用 jCarousel 使部分滑动?因为我尝试了很多方法,但从来没有工作过。它更好地使用其他插件来滑动内容部分?
导入 jQuery 库
<script type="text/javascript" src="jcarousellite_1.0.1.min.js"></script>
<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js?ver=1.9.1'></script>
HTML:
<div id="news-content">
<h1>News</h1>
<hr/>
<div id="firstnews">
<article id="loop-news">
<img src="image1.png" />
<a href="#">Title 1</a>
<p>Text Title 1</h3>
</article>
<article id="loop-news">
<img src="image2.png" />
<a href="#">Title 2</a>
<p>Text Title 2</p>
<h3>Read more</h3>
</article>
</div>
<!-- Just want to show this articles below when click on "SHOW MORE NEWS" -->
<div id="secondnews">
<article id="loop-news">
<img src="image1.png" />
<a href="#">Text only show</a>
<p>Text Title 1</h3>
</article>
<article id="loop-news">
<img src="image2.png" />
<a href="#">Title 2</a>
<p>Text Title 2</p>
<h3>Read more</h3>
</article>
</div>
<hr/>
<a href="#" id="nextBtn">SHOW MORE NEWS(+)</a>
</div>
查询:
<script type="text/javascript">
$(document).ready(function() {
$("news-content").jCarouselLite({
btnPrev: "#nextBTN",
visible: 1
})
});
</script>