使用jScrollPane循环2标题(Cycle2 Captions with jScrollPane)

编程入门 行业动态 更新时间:2024-10-23 21:37:48
使用jScrollPane循环2标题(Cycle2 Captions with jScrollPane)

我正在尝试将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 :)

更多推荐

本文发布于:2023-08-07 19:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465543.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标题   jScrollPane   Captions

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!