Aurelia and UIkit scrollyspy

时间:2015-06-30 13:36:32

标签: uikit aurelia getuikit

I'm trying to use UIkit scrollspy together with aurelia but can't get it to work. I downloaded skeleton-navigation and installed uikit with jspm. Inside app.js I have:

import 'uikit';
import 'uikit/css/uikit.css!';

UIkit css elements work fine but scrollspy doesn't work. I have something like this inside my html:

<div class="uk-panel uk-panel-box uk-scrollspy-init-inview uk-scrollspy-inview uk-animation-fade" data-uk-scrollspy="{cls:'uk-animation-fade', repeat: true, delay:1000}"> .... </div>

1 个答案:

答案 0 :(得分:3)

嗨,我找到了一个简单的方法。

只需在一个静态容器中添加 data-uk-observe 属性即可。我把它放在我的 index.html 的body标签中,因为在aurelia应用程序中是唯一的静态内容: - )

这样UIKit会观察到dom的变化,当渲染模板时,它将递归搜索新的组件

我不确定性能问题,但到目前为止还不错。

示例:

<body aurelia-app="main" data-uk-observe>