Coda-Slider 上一个和下一个按钮隐藏
非常简单的问题,我知道这只是 if / else if 语句的问题,但我无法让它们正确运行。
有一个 SerialScroll 插件,但是它似乎不适用于 coda-slider。
jQuery(function( $ ){
var $prev = $('#before'),//prev button
$next = $('#after');//next button
$('.slider').serialScroll({
//...
cycle:false, //you probably don't want this
onBefore:function( e, elem, $pane, $items, pos ){
$prev.add($next).show();
if( pos == 0 )
$prev.hide();
else if( pos == $items.length-5 )
$next.hide();
}
//...
});
});
所以,我不确定我是否在serialscroll方面遗漏了一些东西,或者应该只为它编写一个简单的JS情景片段,而我在这方面遇到了麻烦!
我已经使用并设置了cycle: false,如您所见,虽然它会停止滚动并使按钮不执行任何操作,但它们不会消失
提前感谢!
Pretty simple question, I know it's just a matter of if / else if statements but I'm unable to get them to run correctly.
I'm using the basis of http://jqueryfordesigners.com/coda-slider-effect/, I can get them hidden, etc, but when it comes to having them available depending on the situation (what is currently selected) I'm just unable to get it to work correctly.
There's a serialscroll plugin for it, but, it doesn't seem to be working for coda-slider.
jQuery(function( $ ){
var $prev = $('#before'),//prev button
$next = $('#after');//next button
$('.slider').serialScroll({
//...
cycle:false, //you probably don't want this
onBefore:function( e, elem, $pane, $items, pos ){
$prev.add($next).show();
if( pos == 0 )
$prev.hide();
else if( pos == $items.length-5 )
$next.hide();
}
//...
});
});
So, I'm not sure if I'm missing something on the serialscroll side, or should just write a simple situational piece of JS for it, which I'm having trouble doing!
I have used and have set cycle: false as you can see, and while it will stop scrolling and make the buttons do nothing, they will not dissapear
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的 onBefore 函数被调用了吗
is your onBefore function is being called