All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bsf.js.scrollspy.js Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
/*
 ========================================================================
 Bootstrap: scrollspy.js v3.4.1
 https://getbootstrap.com/docs/3.4/javascript/#scrollspy
 ========================================================================
 Copyright 2011-2019 Twitter, Inc.
 Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 ======================================================================== */
var process=process||{env:{NODE_ENV:"development"}};
+function(b){function e(a,f){this.$body=b(document.body);this.$scrollElement=b(a).is(document.body)?b(window):b(a);this.options=b.extend({},e.DEFAULTS,f);this.selector=(this.options.target||"")+" .nav li > a";this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on("scroll.bs.scrollspy",b.proxy(this.process,this));this.refresh();this.process()}function l(a){return this.each(function(){var f=b(this),h=f.data("bs.scrollspy"),c="object"==typeof a&&a;h||f.data("bs.scrollspy",
h=new e(this,c));if("string"==typeof a)h[a]()})}e.VERSION="3.4.1";e.DEFAULTS={offset:10};e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)};e.prototype.refresh=function(){var a=this,f="offset",h=0;this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();b.isWindow(this.$scrollElement[0])||(f="position",h=this.$scrollElement.scrollTop());this.$body.find(this.selector).map(function(){var c=
b(this);c=c.data("target")||c.attr("href");var d=/^#./.test(c)&&b(c);return d&&d.length&&d.is(":visible")&&[[d[f]().top+h,c]]||null}).sort(function(c,d){return c[0]-d[0]}).each(function(){a.offsets.push(this[0]);a.targets.push(this[1])})};e.prototype.process=function(){var a=this.$scrollElement.scrollTop()+this.options.offset,f=this.getScrollHeight(),h=this.options.offset+f-this.$scrollElement.height(),c=this.offsets,d=this.targets,k=this.activeTarget,g;this.scrollHeight!=f&&this.refresh();if(a>=
h)return k!=(g=d[d.length-1])&&this.activate(g);if(k&&a=c[g]&&(void 0===c[g+1]||a




© 2015 - 2024 Weber Informatics LLC | Privacy Policy