Sha256: 1c638bdf7498168f5f3ecc45ba3bcacfedc114097b635a4f3b1889aeb776a659

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

!function ($) {

  $(function(){

    // IE10 viewport hack for Surface/desktop Windows 8 bug
    // See Getting Started docs for more information
    if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
      var msViewportStyle = document.createElement("style");
      msViewportStyle.appendChild(
        document.createTextNode(
          "@-ms-viewport{width:auto!important}"
        )
      );
      document.getElementsByTagName("head")[0].
        appendChild(msViewportStyle);
    }


    var $window = $(window);
    var $body   = $(document.body);

    var navHeight = $('.navbar').outerHeight(true) + 10;

    $body.scrollspy({
      target: '.bs-sidebar',
      offset: navHeight
    });

    $window.on('load', function () {
      $body.scrollspy('refresh');
    });

    $('.bs-docs-container [href=#]').click(function (e) {
      e.preventDefault();
    });

    // back to top
    setTimeout(function () {
      var $sideBar = $('.bs-sidebar');

      $sideBar.affix({
        offset: {
          top: function () {
            var offsetTop      = $sideBar.offset().top;
            var sideBarMargin  = parseInt($sideBar.children(0).css('margin-top'), 10);
            var navOuterHeight = $('.bs-docs-nav').height();

            return (this.top = offsetTop - navOuterHeight - sideBarMargin);
          },
          bottom: function () {
            return (this.bottom = $('.bs-footer').outerHeight(true));
          }
        }
      });
    }, 100);

    setTimeout(function () {
      $('.bs-top').affix();
    }, 100);
});
}(window.jQuery);

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scms-4.2.5 assets/blank-template/js/application.js
scms-4.2.4 assets/blank-template/js/application.js
scms-4.2.3 assets/blank-template/js/application.js
scms-4.2.2 assets/blank-template/js/application.js
scms-4.2.0 assets/blank-template/js/application.js