$.fn.scrollto = function()

in src/assets/js/main.js [509:548]


  $.fn.scrollto = function (options) {
    var settings = $.extend(
      {
        offset_lg: 0,
        offset_sm: 0,
        exclude: 'tabbed-link',
      },
      options
    );

    var offset = settings.offset_lg;

    $.subscribe('breakpoints', function (obj, media) {
      offset = media.small ? settings.offset_sm : settings.offset_lg;
    });

    this.on('click.scrollto', function (event) {
      var $anchor = $(this);
      var id = $anchor.attr('href').split('#')[1];

      if ($('#' + id).length && !$anchor.hasClass(settings.exclude)) {
        event.preventDefault();
        $.publish('scrollto', [$anchor]);
        var $el = $('#' + id);
        var top = id == 'top' ? $el.offset().top : $el.offset().top - offset;
        $('html').velocity('scroll', { duration: 900, offset: top });

        var url_state =
          window.location.protocol +
          '//' +
          window.location.host +
          window.location.pathname +
          '#' +
          id;
        window.history.pushState({ href: url_state }, '', url_state);
      }
    });

    return this;
  };