滑块,第 5 张幻灯片后,倒回需要更改以继续前进
因此滑块移动到右侧直到第 5 张幻灯片(最后一张幻灯片),第五张幻灯片之后,它自动移动到左侧到第一张幻灯片。有没有机会让它滑到右侧而不是倒回? 这是代码 -
function scrollToRight() {
if (global_current_elem == 5) {elem = 1;}
else {elem = global_current_elem + 1;}
jQuery('#slider_element').scrollTo('#element'+elem, 500, {easing:'easeInOutCubic', axis:'x' });
set_active_btn(elem);
global_current_elem = elem;
}
function scrollToLeft() {
if (global_current_elem == 1) {elem = 5;}
else {elem = global_current_elem - 1;}
jQuery('#slider_element').scrollTo('#element'+elem, 500, {easing:'easeInOutCubic', axis:'x' });
set_active_btn(elem);
global_current_elem = elem;
}
So slider moves to right side till 5th slide (the last slide), after fifth slide, it automatically moves to the left side to first slide. Is there any chance to make it slide it to right side not rewind back?
Here's code -
function scrollToRight() {
if (global_current_elem == 5) {elem = 1;}
else {elem = global_current_elem + 1;}
jQuery('#slider_element').scrollTo('#element'+elem, 500, {easing:'easeInOutCubic', axis:'x' });
set_active_btn(elem);
global_current_elem = elem;
}
function scrollToLeft() {
if (global_current_elem == 1) {elem = 5;}
else {elem = global_current_elem - 1;}
jQuery('#slider_element').scrollTo('#element'+elem, 500, {easing:'easeInOutCubic', axis:'x' });
set_active_btn(elem);
global_current_elem = elem;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
scrollToRight
中的代码在第一行中明确编写为执行此操作 -if (global_current_elem == 5) {elem = 1;}
如果不这样做,请删除该行想要倒回行为。
Your code in
scrollToRight
is clearly written to do that in the first line -if (global_current_elem == 5) {elem = 1;}
Remove that line if you don't want the rewind behavior.