我正在尝试将jScrollPane与插件Cycle2一起使用,但它没有按预期工作。
以下图像是Cycle2插件中的循环标题元素,其中包含每张幻灯片的动态内容(数据循环标题)。
所以,我正在尝试使用jScrollPane添加滚动条。 OnLoad,它按预期工作,但一旦循环,滚动窗格就会很多,当返回第一张幻灯片时,它会显示在第二张图片上:
所以,我正在使用的代码如下:
$(window).bind('load',function(){ $('#text').jScrollPane( { verticalDragMaxHeight:20, verticalDragMinHeight:20, animateScroll:true } ); var api = $('#text').data('jsp'); $('#slideshow').on('cycle-after',function(e, opts){ api.reinitialise(); }); });幻灯片的结构我认为它不相关,因为它是带有标题模板等的基本结构。
拜托,我真的需要这个工作! :)
I'm trying to use jScrollPane with the plugin Cycle2 but it isn't working as expected.
The following images are the cycle-caption element from the Cycle2 plugin with my dynamic content from each slide (data-cycle-title).
So, I'm trying to add a scrollbar using jScrollPane. OnLoad, it works as expected, but as soon as it cycle, the scrollpane gets lots and when gets back to the first slide, it shows as on the second image:
So, the code I'm using is the following:
$(window).bind('load',function(){ $('#text').jScrollPane( { verticalDragMaxHeight:20, verticalDragMinHeight:20, animateScroll:true } ); var api = $('#text').data('jsp'); $('#slideshow').on('cycle-after',function(e, opts){ api.reinitialise(); }); });The structure of the slideshow I think that it's not relevant, since it is the basic structure with a caption template, etc.
Please, I really need this to work! :)
最满意答案
我设法让它与一些肮脏的解决方法一起工作。 在此发布,以便如果有人遇到同样的问题可以让它工作!
$('#slideshow').on('cycle-after',function(e, opts) { setTimeout(enable_scroll,5); } ); function enable_scroll(){ $('#text').jScrollPane(settings); }setTimeout是关键!
希望能帮助到你 :)
I managed to get it to work with a little dirty workaround. Posting here so that if someone encounters the same problem can get it working!
$('#slideshow').on('cycle-after',function(e, opts) { setTimeout(enable_scroll,5); } ); function enable_scroll(){ $('#text').jScrollPane(settings); }The setTimeout is the key!
Hope it helps :)
更多推荐
发布评论