//NEXT
$('.social-next a').on('click', function(e){
e.preventDefault();
$('.social').animate({'margin-left': '-=940'}, 500);
});
//PREVIOUS
$('.social-previous a').on('click', function(e){
e.preventDefault();
$('.social').animate({'margin-left': '+=940'}, 500);
});
使用此代码,您可以永远滑动,从所有内容中滑到任何地方,我无法让按钮消失,我开始遇到奇怪的错误。我尝试使用 first 和 last 来突出隐藏按钮,但我不确定我哪里出错了,我开始尝试替代方法,我什至不好意思提及......我知道这只是一个简单的 1-2-liner 虽然...
HTML:
<div class="social">
<div class="slide">
<div class="intro">xxx.</div><!-- <a href="#" class="show-slides">view more..</a> -->
</div>
<div class="slide">
<div class="intro">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima error.<a href="#" class="open-slides"></div>
<div class="content">dolor dolor dolor </div><a href="#" class="close-slides"></a>
</div>
<div class="slide">
<div class="intro">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima error.</div><a href="#" class="open-slides">
<div class="content">ipsum ipsum ipsum ipsum ipsum</div><a href="#" class="close-slides"></a>
</div>
<div class="slide">
<div class="intro">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima error.<a href="#" class="open-slides"></div>
<div class="content"><div class="tekst">Lorem Lorem Lorem Lorem Lorem</div></div><a href="#" class="close-slides"></a>
</div>
</div>