Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- var reachedBottomTracked;
- var scrolledTracked;
- $('nav.global a').click(function(event) {
- if (
- location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
- location.hostname == this.hostname
- ) {
- var target = $(this.hash);
- target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
- if (target.length) {
- event.preventDefault();
- $('html, body').animate(
- {
- scrollTop: target.offset().top
- },
- 1000
- );
- gtag('event', 'navV8_' + this.hash.slice(1));
- }
- }
- });
- $(window).on('scroll', function() {
- if (!scrolledTracked) {
- scrolledTracked = true;
- gtag('event', 'scrolledV8');
- }
- if (
- !reachedBottomTracked &&
- $(window).scrollTop() + $(window).height() === $(document).height()
- ) {
- reachedBottomTracked = true;
- gtag('event', 'reached_bottomV8');
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement