docsify icon indicating copy to clipboard operation
docsify copied to clipboard

Does it possible to scroll when <a/> is clicked but not hashchange?

Open Kido-200 opened this issue 3 years ago • 8 comments

Feature request

What problem does this feature solve?

Click a a link after first time, it will not scroll.

What does the proposed API look like?

https://ant.design/components/grid/#components-grid-demo-flex-align In antd doc, we can click the right siderbar to trigger scroll everytime. image

How should this be implemented in your opinion?

Maybe addEventListener to click, and scroll when a link is clicked? image

Are you willing to work on this yourself?

I can try, but I just begin with using doscify,maybe have a lot of conflicts with other ability.

Kido-200 avatar Mar 29 '22 03:03 Kido-200

docsify does not provide a right sidebar, you can use a plugin for that. The right sidebar of antd doc is actually also in the form of anchor points.

sy-records avatar Mar 29 '22 04:03 sy-records

docsify does not provide a right sidebar, you can use a plugin for that. The right sidebar of antd doc is actually also in the form of anchor points.

不好意思,我可能没表述好。 在docsify的siderbar,点击同一个sider item,第二次开始,不会触发滚动,而antd的每次点击都可以触发滚动。可以做成每次点击能触发吗?

Kido-200 avatar Mar 29 '22 04:03 Kido-200

Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

Koooooo-7 avatar Mar 29 '22 04:03 Koooooo-7

Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

https://docsify.js.org/#/pwa?id=create-serviceworker click "Create serviceWorker", then scroll the page, then click "Create serviceWorker" again, it will not scroll.Because the hash is not changed. image

Kido-200 avatar Mar 29 '22 04:03 Kido-200

Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

https://docsify.js.org/#/pwa?id=create-serviceworker click "Create serviceWorker", then scroll the page, then click "Create serviceWorker" again, it will not scroll.Because the hash is not changed. image

Gotcha, I'm wondering what the use case that you wanna scroll back to the section header when you click it again. Normally, there is no need to back to current content's header indeed.

Koooooo-7 avatar Mar 29 '22 04:03 Koooooo-7

Could u provide some details based on our site https://docsify.js.org/ ? I have no idea what you meant scroll when <a/> is clicked but not hashchange.

https://docsify.js.org/#/pwa?id=create-serviceworker click "Create serviceWorker", then scroll the page, then click "Create serviceWorker" again, it will not scroll.Because the hash is not changed. image

Gotcha, I'm wondering what the use case that you wanna scroll back to the section header when you click it again. Normally, there is no need to back to current content's header indeed.

Sometimes the sction is long, and click and scroll is very natural in my mind, just like "back to top" button, so I click it,but nothing happend which makes me confused. Meanwhile, when I use antd or other website, they can scroll natural , which make me feel inconsistent.

So it's just for enhancing the feel of interaction in some special situation, maybe I am a bit nitpicky. Thanks for your reply.

Kido-200 avatar Mar 29 '22 06:03 Kido-200

Sometimes the sction is long, and click and scroll is very natural in my mind, just like "back to top" button, so I click it,but nothing happend which makes me confused. Meanwhile, when I use antd or other website, they can scroll natural , which make me feel inconsistent.

AFAIK, the sort of antd sites have the anchor siderbar, it is different.

So it's just for enhancing the feel of interaction in some special situation, maybe I am a bit nitpicky. Thanks for your reply.

no prob. Currently, If you wanna click back the section header, you could clink to other sidebar link and back instead.

Koooooo-7 avatar Mar 29 '22 08:03 Koooooo-7

Currently, If you wanna click back the section header, you could clink to other sidebar link and back instead.

another approach would be to refresh the page, which should take you to where you were last anchored

andrewkmin avatar Mar 31 '22 19:03 andrewkmin