初始化后将幻灯片添加到Swipe.JS中
Adding slides to Swipe.JS after initialization?
这是一个伟大的移动轮播脚本。有没有人找到一种方法来添加幻灯片到初始化后的旋转木马?我的目标是在用户到达最后一张幻灯片时添加更多项目(类似于"无限旋转木马")。
下面是一个代码示例:this.collection.each(function(pic){
var slide = new PictureSlideView({model:pic});
this.$('.slide-container').append(slide.el);
},this);
this.$('.swipe').Swipe({
continuous: false
});
// this doesn't work:
var newModel = new Picture({...});
var newSlide = new PictureSlideView({model:newModel});
this.$('.slide-container').append(slide.el);
// insert awesome code to fix it here:
// ...
检查脚本源,我发现在添加新元素后调用setup
函数工作:
this.collection.each(function(pic){
var slide = new PictureSlideView({model:pic});
this.$('.slide-container').append(slide.el);
},this);
this.carousel = new Swipe(this.el.getElementsByClassName('swipe')[0], {
continuous: false
});
// append new slide
var newModel = new Picture({...});
var newSlide = new PictureSlideView({model:newModel});
this.$('.slide-container').append(slide.el);
// run the setup again
this.carousel.setup();
相关文章:
- 可以't让我的if语句处理js中的html表单输入
- 使用agility.js进行页面布局和合成
- 使用Clipboard.js复制span文本
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 强制模板刷新ember.js
- 如何编写HTML输入的JS内联
- Angular JS IE9 Hashbang url rewriting
- 使用JS将数组转换为json对象
- Node.js v6.2.0类扩展不是函数错误
- 当js函数's已执行
- 要求未定义JS回调参数
- 在自定义mean.io包中使用angular-chart.js作为依赖项
- 无法在数据endVal中设置值=“”;{{ucount}}”;使用Angular JS的CountUp
- 如何从Java/scala调用js美化程序
- 如何更改<svg>标记为<img>用js标记
- 这个swipe.js函数返回了什么
- 使用swipe.js生成滑动对象
- 初始化后将幻灯片添加到Swipe.JS中
- 如何禁用swipe.js旋转木马
- 在Swipe JS中使用项目符号作为导航