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

Uncaught TypeError: this.calculateStickyHeight is not a function #48

Closed
shakunage95 opened this issue Jun 17, 2024 · 5 comments
Closed

Comments

@shakunage95
Copy link

每当窗口resize的时候都会出现错误信息,我想了很久都没有解决,虽然不影响正常使用,希望大神能帮忙分析一下
image

@yaohaixiao
Copy link
Owner

可以把你的初始化配置贴出来吗

@shakunage95
Copy link
Author

可以把你的初始化配置贴出来吗

我的配置是这样的
image

@yaohaixiao
Copy link
Owner

yaohaixiao commented Jun 20, 2024

我本地测试过,没有报出你这个错误啊,另外你的配置中的 closeOnClickModal 和 showNavModalFirst 在配置了 position = 'sticky' 和 hasToolbar 后是无效的,你可以尝试我的配置,当然根据你的需要其调整一下:

`const defaults = Outline.DEFAULTS
let outline

    defaults.position = 'sticky'
    defaults.stickyHeight = 86
    defaults.parentElement = '#aside'
    defaults.scrollElement = 'body'
    defaults.homepage = '../index.html'
    outline = new Outline(defaults)`

如果有可以访问的DEMO地址最好,因为我无法重新你的错误

@shakunage95
Copy link
Author

文章地址,请帮我看看

@yaohaixiao
Copy link
Owner

yaohaixiao commented Jun 22, 2024

我看了下,应该不是BUG,是你的配置有问题,不能 reload(),reload() 后使用的默认配置 position='relative',你用那个版本的,用最新版本的试试

企业微信截图_17190192938684
企业微信截图_17190193507078

你看我本地用的最新版本的没有这个问题,老的版本以前的 reload() 方法有点问题,建议你用最新版本的,或者配置完后,不要使用 reload()

并且建议你使用 sticky 定位显示,设置 stickyHeight 参数,将值设置为你的固定位置菜单的高度,以便这个文章导航菜单都可以显示,目前你的菜单被挡住了,就是没有设置 stickyHeight 导致的

yaohaixiao added a commit that referenced this issue Jun 22, 2024
yaohaixiao added a commit that referenced this issue Jun 22, 2024
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