conference_lite-8.x-1.0/js/custom/in-page-navigation-scroll.js

js/custom/in-page-navigation-scroll.js
(function ($, Drupal, drupalSettings, once) {
  Drupal.behaviors.inPageNav = {
    attach: function (context, settings) {
      once('inPageNavInit', ".link--smooth-scroll", context).forEach(function (item) {
        var adminHeight = parseInt($('body').css('paddingTop')) || 0;
        var anchorDestination = this.hash;
        e.preventDefault();
        $('html, body').animate({
          //scrollTop: $($(this).attr("href")).offset().top
          scrollTop: $(anchorDestination).offset().top - drupalSettings.conference_lite.inPageNavigation.inPageNavigationOffset - adminHeight
        }, 1000);
        if (history.pushState) {
          history.pushState(null, null, anchorDestination);
        } else {
          location.hash = anchorDestination;
        }
      });

    }
  };
})(jQuery, Drupal, drupalSettings, once);

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc