Sha256: ea78543f7529f922cde7e1c0f4f54406e07475c2238cb06d835cb54a0fe7d8c1

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

//= require ../lib/_jquery_ui
//= require ../lib/_jquery.tocify
//= require ../lib/_imagesloaded.min
(function (global) {
  'use strict';

  var closeToc = function() {
    $(".tocify-wrapper").removeClass('open');
    $("#nav-button").removeClass('open');
  };

  var makeToc = function() {
    global.toc = $("#toc").tocify({
      selectors: 'h1, h2',
      extendPage: false,
      theme: 'none',
      smoothScroll: false,
      showEffectSpeed: 0,
      hideEffectSpeed: 180,
      ignoreSelector: '.toc-ignore',
      highlightOffset: 60,
      scrollTo: -1,
      scrollHistory: true,
      hashGenerator: function (text, element) {
        return element.prop('id');
      }
    }).data('toc-tocify');

    $("#nav-button").click(function() {
      $(".tocify-wrapper").toggleClass('open');
      $("#nav-button").toggleClass('open');
      return false;
    });

    $(".page-wrapper").click(closeToc);
    $(".tocify-item").click(closeToc);
  };

  // Hack to make already open sections to start opened,
  // instead of displaying an ugly animation
  function animate() {
    setTimeout(function() {
      toc.setOption('showEffectSpeed', 180);
    }, 50);
  }

  $(function() {
    makeToc();
    animate();
    $('.content').imagesLoaded( function() {
      global.toc.calculateHeights();
    });
  });
})(window);

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 docs/source/javascripts/app/_toc.js
solidus_json_api-0.3.0 docs/source/javascripts/app/_toc.js
spree_api_v2-0.2.2 docs/source/javascripts/app/_toc.js
solidus_api_v2-0.2.2 docs/source/javascripts/app/_toc.js
solidus_api_v2-0.2.1 docs/source/javascripts/app/_toc.js
spree_api_v2-0.2.1 docs/source/javascripts/app/_toc.js
spree_api_v2-0.2.0 docs/source/javascripts/app/_toc.js
solidus_api_v2-0.2.0 docs/source/javascripts/app/_toc.js