1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

実装 - PlanetArticleListへのAuto scroll追加

This commit is contained in:
Rokt33r
2015-08-23 03:42:00 +09:00
parent 9712be909d
commit 4319711dc6
8 changed files with 23 additions and 7 deletions

View File

@@ -230,6 +230,18 @@ module.exports = React.createClass({
return
}
var listElement = this.refs.list.refs.articles.getDOMNode()
var articleElement = listElement.querySelectorAll('li')[index]
var overflowBelow = listElement.clientHeight + listElement.scrollTop < articleElement.offsetTop + articleElement.clientHeight
if (overflowBelow) {
listElement.scrollTop = articleElement.offsetTop + articleElement.clientHeight - listElement.clientHeight
}
var overflowAbove = listElement.scrollTop > articleElement.offsetTop
if (overflowAbove) {
listElement.scrollTop = articleElement.offsetTop
}
if (article.type === 'code') {
params.localId = article.localId
this.transitionTo('codes', params)