Skip to content
New issue

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

data 为 HTMLElement 时的问题 #421

Open
whorusq opened this issue Jul 6, 2017 · 1 comment
Open

data 为 HTMLElement 时的问题 #421

whorusq opened this issue Jul 6, 2017 · 1 comment

Comments

@whorusq
Copy link

whorusq commented Jul 6, 2017

我采用如下方式填充 content,节点 iSlider-page* 对应的 html 内容在页面里

var data = [
        {'content': document.getElementById('iSlider-page1')},
        {'content': document.getElementById('iSlider-page2')},
        {'content': document.getElementById('iSlider-page3')},
];

浏览器预览的时候,发现第3页的内容会在第1页叠加显示,第3页之后再加的其它页面,也会叠加;
滑动到第二页(只要往后面滑动一次),再返回第一页查看,发现已经正常了。

请问 @ALL,这是不是 bug ?

我目前的解决方案是:

// 1. iSlider-page3 及以后的每一页,追加 style="display: none"
// 2. iSider 初始化的时候追加 onSlideChange,动态的显示对应的 dom,如下
        onSlideChange: function(num, dom) {
            var iCurrPage = num + 1;
            var oCurrPageDom = document.getElementById('iSlider-page' + iCurrPage);
            if (oCurrPageDom) {
                oCurrPageDom.style.display = 'block';
            }
        },
@shinate
Copy link
Member

shinate commented Jan 18, 2018

用css解决就好,每一帧都会有独立的css样式,可以用外层的class控制内容展示与隐藏,对内容islider是没有任何干预的。所以选用的切换效果不同会有各种各样的展现,这些都是需要具体业务自己来实现的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants