NanoScroller不会触发自身 [英] NanoScroller not triggering itself

查看:70
本文介绍了NanoScroller不会触发自身的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码应能够根据

The code below should be able to trigger the pane and slider to appropriate display css properties according to nanoscroller documentation. However, the scroller doesn't show the slider until I do some action in browser such as pressing F12 to fireup firebug or right clicking an element inside to inspect it. What could possibly be going wrong?

        $(".nano").nanoScroller({
        alwaysVisible: true,
        scroll: "bottom"    
    });

推荐答案

如果您使用参数调用nanoScroller(),则插件的初始化可能会失败,尤其是使用动态内容时,至少在v0.7.4版本上看起来如此

It looks like at least on version v0.7.4 if you call nanoScroller() with arguments the initialization of the plug-in could fail, above all with dynamic content.

如果使用的是$('#yourDiv').animate(),请确保在动画结束时已完成对nanoScroller()的调用.如果使用$.getJSON(),则相同,请在正确提取内容之后执行此操作.如果在两个事件之后都同时使用animate()getJSON()调用nanoScroller(),因为它不知道哪个进程将首先完成,并且多次调用nanoScroller()不会破坏任何内容.

If you are using $('#yourDiv').animate() be sure the call to nanoScroller() is done when the animation is finished. The same if you are using $.getJSON(), do it after the content has be fetched properly. If you are using both animate() and getJSON() call nanoScroller() after both events because it is unknow which process is going to finish first and several calls to nanoScroller() will not spoil anything.

这里的解决方法是:先调用无参数的nanoScroller(),然后在需要参数后再次调用.

And here the workaround is: call first nanoScroller() with no arguments and right after call it again if you require arguments.

$('.nano').nanoScroller();
$('.nano').nanoScroller({ alwaysVisible: true, scroll: 'top' });

这篇关于NanoScroller不会触发自身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆