#Hash Change onScroll
Need to add mootools version too :)
Change the value of the url by scrolling through div's data-id or #
| //uses on instead of bind, so it works with 1.9.1/2.0 + | |
| $(document).on('scroll',function(e) | |
| { | |
| $('section').each(function() | |
| { | |
| if ( $(this).offset().top < window.pageYOffset + 10 | |
| && $(this).offset().top + | |
| $(this).height() > window.pageYOffset + 10 | |
| ) | |
| { | |
| var data = $(this).data('id'); | |
| window.location.hash = data; | |
| } | |
| }); | |
| }); |
Thanks!
Great, thanks!
Thanks a lot! You are the true guardian of the republic!
Works very well. Thank you.