Comments (5)
旋转木马目前支持的效果很差,后续需要重构。
from switchable.
暂时是可以这样解决的. 仅限 circular: false 的情况下,
内部有个 length 值表示有多少屏可以切换, 计算是 panels.length / step 上取整. 一般情况下, 配置中的 viewsize (可视区域大小) 应该和每一屏的大小是一致的, 这样在切换时就没有任何空白.
但很多需求不是这样的, 比如切一屏滚动一个, 但可视区域是多个, 这样有时就有空白.
类似于 http://aralejs.org/switchable/examples/carousel-special.html 这个例子, 但这里的配置项:
step: 2,
viewSize: [396],
circular: false,
这里, 可视区域 viewsize 是你切换一屏时切几个 panel 的宽度, 这样就可以推算出, 需要切几屏, 类似例子中的, panels.length为 3 个, 每屏切一个, 避免空白后的屏数 length 应 2 屏, 那么, 可以根据 length == Math.ceil(this.panels.length / this.get('step'))
推算出 step 为 1.5 至 2.
当 panels.length 为 4 个, 每屏还是切一个, 正确地屏数是 3, 那么, 推算出 step 为 1.5 至 1.9.
依次类推. 这个方法是山寨了点, 但没重构前可以这样解决下~~
from switchable.
重构可参考这个 http://gallery.kissyui.com/slide/1.1/guide/index.html?spm=0.0.0.0.y0MYuZ
from switchable.
这个组件最早就是源于 kissy 的. 今年 kissy 按照状态机的模式又重构了一遍,可以按照这个改下呀!
from switchable.
转到 #24
from switchable.
Related Issues (20)
- Carousel的最大宽度问题 HOT 6
- 参数circular设置后滚动效果错误 HOT 7
- data-role 应该换成 data-switchable-role HOT 1
- 提交个bug HOT 2
- effects.js变更后请及时更新至SPM HOT 3
- 增加动态 add/remove 功能 HOT 1
- slide组件与tab组件panels冲突 HOT 2
- widget.js文件第一行抛出问题 HOT 4
- 是否可以增加 `multiple: false` 的情况下允许全关闭 HOT 15
- Tab组件可以延迟加载,使用Ajax获取内容吗。 HOT 2
- data-switchable-role 暂时改回 data-role
- Carousel在360安全浏览器下无法正常演示 HOT 5
- carousel 在360浏览器极速模式显示有问题 ,兼容模式下没问题 HOT 1
- arale 很多模块都没有 spm3 doc publish HOT 1
- data-switchable-role 被替换成data-role HOT 1
- switchable 如果没有在初始化的时候指定唯一的 element 参数引发的问题。 HOT 1
- 为什么 spmjs.io 上发布的 1.1.0 版没有 package.json HOT 3
- 怎么实现左右2块半透明遮罩,中间是viewsize区域这样scrollx切换
- Arale-switchable的演示挂掉了 HOT 1
- 这个插件和jquery.switchable有关系不?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from switchable.