Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Now the hashes update on scroll #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions example/js/stickUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ function($) {
//console.log(varscroll);
if(varscroll > testView){
$('.'+itemClass).removeClass(itemHover);
history.pushState(null, null, "#" + $('.menuItem:eq('+i+') a')[0].href.split("#")[1]);
$('.'+itemClass+':eq('+i+')').addClass(itemHover);
} else if(varscroll < 50){
$('.'+itemClass).removeClass(itemHover);
history.pushState(null, null, "#" + $('.menuItem:eq(0) a')[0].href.split("#")[1]);
$('.'+itemClass+':eq(0)').addClass(itemHover);
}
}
if(scrollDir == 'down' && varscroll > contentTop[i]-50 && varscroll < contentTop[i]+50) {
$('.'+itemClass).removeClass(itemHover);
history.pushState(null, null, "#" + $('.menuItem:eq('+i+') a')[0].href.split("#")[1]);
$('.'+itemClass+':eq('+i+')').addClass(itemHover);
}
if(scrollDir == 'up') {
Expand Down
8 changes: 7 additions & 1 deletion example/js/stickUp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions stickUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ function($) {
//console.log(varscroll);
if(varscroll > testView){
$('.'+itemClass).removeClass(itemHover);
history.pushState(null, null, "#" + $('.menuItem:eq('+i+') a')[0].href.split("#")[1]);
$('.'+itemClass+':eq('+i+')').addClass(itemHover);
} else if(varscroll < 50){
$('.'+itemClass).removeClass(itemHover);
history.pushState(null, null, "#" + $('.menuItem:eq(0) a')[0].href.split("#")[1]);
$('.'+itemClass+':eq(0)').addClass(itemHover);
}
}
if(scrollDir == 'down' && varscroll > contentTop[i]-50 && varscroll < contentTop[i]+50) {
$('.'+itemClass).removeClass(itemHover);
history.pushState(null, null, "#" + $('.menuItem:eq('+i+') a')[0].href.split("#")[1]);
$('.'+itemClass+':eq('+i+')').addClass(itemHover);
}
if(scrollDir == 'up') {
Expand Down
8 changes: 7 additions & 1 deletion stickUp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.