_updateActive(/*evt, elem, scrollPos*/) {
if(this._inTransition) {return;}
var winPos = /*scrollPos ||*/ parseInt(window.pageYOffset, 10),
+ changed = false,
curIdx;
if(winPos + this.winHeight === this.docHeight){ curIdx = this.points.length - 1; }
this.$active.removeClass(this.options.activeClass);
if(curIdx !== undefined){
+ if ($(this.$active[0]).attr("href") !== $(this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]')[0]).attr("href")) {
+ changed = true;
+ }
this.$active = this.$links.filter('[href="#' + this.$targets.eq(curIdx).data('magellan-target') + '"]').addClass(this.options.activeClass);
}else{
this.$active = $();
* Fires when magellan is finished updating to the new active element.
* @event Magellan#update
*/
- this.$element.trigger('update.zf.magellan', [this.$active]);
+ if (changed === true) {
+ this.$element.trigger('update.zf.magellan', [this.$active]);
+ }
}
/**