我在一个jQuery移动网络应用程序的工作动态内容的问题。我试过整合dangero.us swiper。 我使用动态html填充swiper-container。我已经尝试在插入html之后使用reinit()函数,就像在其他任务中描述的那样,但没有任何事情发生。jQuery Mobile的使用dangero.us刷卡
这是我的html:
<div data-role="page" id="slider">
.....
<div class="swiper-container">
<div class="swiper-wrapper"> <!-- wrapper -->
<div id="slidecontent"></div> <!-- dyn. html here -->
</div> <!-- wrapper -->
</div>
这是我的填充动态内容的代码,初始化刷卡实例的呼叫重新发起() - 函数在我的浏览
$('#slider').on('pageinit', function(event) {
$('#slidecontent').load('slider_input.html').trigger("create");
// div containers loading
});
$(document).on('pageshow', '#slider', function(){
var myapp2goSwiper = $('.swiper-container').swiper({
pagination: '.pagination',
paginationClickable: true,
slidesPerView: 1,
loop: true,
onSlideClick : function(swiper) {
//Do something when you touch the slide
var i = myapp2goSwiper.clickedSlideIndex;
var a = myapp2goSwiper.activeSlide();
console.log(i);
console.log(a);
}
});
//myapp2goSwiper.reInit();
reinitSwiper(myapp2goSwiper);
});
function reinitSwiper(swiper) {
setTimeout(function() {
swiper.reInit();
}, 500);
};
不显示任何。我能做些什么来刷新或重新启动我的html内容,swiper-instance正常工作?同住的演示是在http://www.m.myapp2go.de/myapp2go-slide.html
我解决我的问题。将我的html内容附加到<div id="slidecontent"></div>
是错误的。我必须直接将HTML内容附加到<div class="swiper-wrapper">
。
现在,它的工作,但:
- 分页不再被显示
- onSlideClick不火了
有什么建议?
我注意到,您的应用程序现在是工作,你能告诉你做了什么?非常感谢! –