显示单个数字 jQuery .each()
有人知道我必须在这个显示单个数字(如“1/3”)的插件中更改什么吗?
我修改了这一行:
$('.' + option.paginationClass, elem).append('<li><a href="#'+ number +'">'+ (number+1) +'</a></li>');
并更改为:
$('.' + option.paginationClass, elem).append('<li><a href="#'+ number +'">'+ (number+1) +'/'+ total +'</a></li>');
现在显示:“1/3 2 /3 3/3 英寸。
Anyone know what I must change in this plugin that displaying a single number ( like "1/3" ) ?
I modified this line:
$('.' + option.paginationClass, elem).append('<li><a href="#'+ number +'">'+ (number+1) +'</a></li>');
and change to this:
$('.' + option.paginationClass, elem).append('<li><a href="#'+ number +'">'+ (number+1) +'/'+ total +'</a></li>');
and now shows me: "1/3 2/3 3/3".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以...我相信您只想在幻灯片中显示当前页码。因此,如果您放映 5 张幻灯片,并且位于第 3 页,那么您只会看到“3/5”。正确的?
因此,为了回答这个问题,这里是围绕您上面发布的代码的原始循环。
但是,为了仅显示我们所在的当前页面,我们需要添加一个条件语句以仅显示一页...
我承认,这段代码根本没有经过测试,但它应该 工作。我不知道的一件事是,当您滚动幻灯片时它是否会自动更新。
希望这有帮助,
斯普里诺724
So... I believe you only want to display the current page number in the slideshow. So if you have a show of 5 slides, and you are on page 3, then you will only see "3/5". Correct?
So, answering this question, here is the original loop surrounding the code you posted above.
However, to only display the current page we are on, we will need to add a conditional statement to display only the one page...
I'll admit, this code is not at all tested, but it should work. One thing I don't know is if it will automatically update as you scroll through the slides.
Hope this helps,
spryno724