alvarotrigo / alvarotrigo/fullPage.js

Change active anchor at custom scroll position

未關閉
#2,209 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
JavaScript
星號
35.4k
分支
7.1k
PR 合併指標
30 天內沒有已合併 PR

描述

### Description

I want to change active anchor when I scrolled exactly to the top of next section, not to middle of current section.
### Steps to reproduce it
1. Switch to mobile view on this [example](http://alvarotrigo.com/fullPage/examples/responsive.html#firstPage)
2. You can see that anchor "Second slide" change class to "active" when green section scrolled just to middle of the screen. http://take.ms/ev6ui
### How to fix

We can add new option, like `scrollRatio` . Anchor should change class to "active" when page scrolled to the top of next section (`scrollRatio: 0`). Default would be `scrollRatio: .5`.

**We can change this code**
`var screen_mid = currentScroll + ($window.height() / 2.0);`
**to**
`var screen_mid = currentScroll + ($window.height() * options.scrollRatio);`

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。