We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$('.the-same-top-class').each(function(index, element) { new Switchable({ panels: $(element).find('.content'), triggers: $(element).find('.triggers'), activeTriggerClass: 'trigger-selected', autoplay: true, circular: true, interval: 2500, effect: 'scrollx', duration: 300, delay: 500 }).render(); ... })
,因为switchable 的 triggers 参数 和 pannels 参数除了接受 字符选择器之外还支持jQuery数组,所以我是传入了数组,因为dom结构都一样,要是传入字符选择器的话会混乱 3. 但是页面初始化成功之后轮播在没有发生页面滚动的时候是正常的 4. 页面发生滚动后,轮播就不再自动播放了 5. debug源码之后发现,问题出现在 ’arale/switchable/1.0.2/plugins/autoplay-debug‘ 的 install 函数里面 6. 问题代码在这里
// 滚出可视区域后,停止自动播放 this._scrollDetect = throttle(function() { console.log($(element).html()); console.log(isInViewport(element) ? "start" : "stop"); // 不自动播放的时候,输出这里的element,指向的不是轮播的 viewport ,而是一个空的 div that[isInViewport(element) ? "start" : "stop"](); });
element
that[isInViewport(element) ? "start" : "stop"]();
triggers
pannels
bug
The text was updated successfully, but these errors were encountered:
arale组件element跟template总要传1个的,是你不熟悉arale的widget机制
Sorry, something went wrong.
No branches or pull requests
,因为switchable 的 triggers 参数 和 pannels 参数除了接受 字符选择器之外还支持jQuery数组,所以我是传入了数组,因为dom结构都一样,要是传入字符选择器的话会混乱
3. 但是页面初始化成功之后轮播在没有发生页面滚动的时候是正常的
4. 页面发生滚动后,轮播就不再自动播放了
5. debug源码之后发现,问题出现在 ’arale/switchable/1.0.2/plugins/autoplay-debug‘ 的 install 函数里面
6. 问题代码在这里
element
会指向一个空的div,导致页面一旦发生滚动,这个that[isInViewport(element) ? "start" : "stop"]();
会一直返回 stop ,因为那个空的 div 根本就不在 viewport 里。element
这个参数说明element
这个参数的说明triggers
pannels
这两个参数需要唯一之外,还需要指定对应的 父级element
参数,要不自动播放会失效,不知道是不是个bug
,此坑已踩,望加文档或修正,避免他人再踩。The text was updated successfully, but these errors were encountered: