| 505 | * ========================== */ |
| 506 | |
| 507 | function ScrollSpy(element, options) { |
| 508 | var process = $.proxy(this.process, this) |
| 509 | , $element = $(element).is('body') ? $(window) : $(element) |
| 510 | , href |
| 511 | this.options = $.extend({}, $.fn.scrollspy.defaults, options) |
| 512 | this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) |
| 513 | this.selector = (this.options.target |
| 514 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 |
| 515 | || '') + ' .nav li > a' |
| 516 | this.$body = $('body') |
| 517 | this.refresh() |
| 518 | this.process() |
| 519 | } |
| 520 | |
| 521 | ScrollSpy.prototype = { |
| 522 | |