为什么ascensor.js插件不能工作?

Why ascensor.js plugin doesn't work?

本文关键字:工作 不能 插件 ascensor js 为什么      更新时间:2023-09-26

我正在使用插件ascender .js,我试图做一个简单的例子,但它不起作用,我看不到错误。

http://jsfiddle.net/C2vLH/2/

JS

$(document).ready(function () {
    $('#ascensorBuilding').ascensor({
        ascensorName: 'ascensor',
        childType: 'section',
        ascensorFloorName: ['hello1', 'hello2', 'hello3', 'hello4'],
        time: 1000,
        windowsOn: 1,
        direction: "chocolate",
        ascensorMap: [
            [1, 0],
            [1, 1],
            [2, 1]
        ],
        easing: 'easeInOutQuad',
        keyNavigation: true,
        queued: false,
        queuedDirection: "y",
        overflow: "hidden"
    });
});

<button class="ascensor ascensorLink0">hello1</button>
<button class="ascensor ascensorLink1">hello2</button>
<button class="ascensor ascensorLink2">hello3</button>
<button class="ascensor ascensorLink3">hello4</button>
<div id="ascensorBuilding">
    <section>Hello1</section>
    <section>Hello2</section>
    <section>Hello3</section>
    <section>Hello4</section>
</div>

在结果中,我看到所有的部分在同一个页面中,当我点击按钮时没有发生任何事情…

你知道有什么插件有类似的效果吗?

任何提示或建议都会很感激。如果你需要更多的信息,告诉我,我会编辑这篇文章。

有很多问题,它们并不简单(除非上升脚本的版本过时了)。第一个问题相当简单,并说明了最初的问题——一些文档与代码不匹配。特别是,大小写不匹配。

例如,您有childType: 'section'(小写c),但您需要ChildType: 'section'大写c。这对所有设置都是正确的。

修复后,乐趣开始!您指定的各种数组遵循文档,但是jsfiddle中的升序脚本正在尝试解析字符串。"hello1 | hello2 |..."['hello1', 'hello2'...] (AscensorMap的类似问题)。可能上升脚本引用的是一个过时的版本,或者插件已经更改,文档还没有更新。

当前答案的反面现在是正确的

使用最新版本的Ascensor(1.8.0(2014-02-23)),您必须使用小写字母指定属性名称。

。change ChildType: 'section' to childType: 'section' .

遗憾的是,网络上所有的例子都是使用旧版本。