<commit_before>define(function(require) {

var tpl = require('text!templates/products/subnav.html')

return Backbone.View.extend({

  className: 'subnav',

  events: {
    "click a": "scroll",
  },

  scroll: function(e){
    e.preventDefault() 
    var anchor = $(e.currentTarget)
    // highlight
    var el = $(anchor).parent()
    if (el.hasClass('active')) return
    $('.subnav li').removeClass('active');
    el.addClass('active');
    var target = $(anchor).data("target");
    var position = $('#'+target).offset().top - 50
    $('html').animate({
        'scrollTop': position 
    }, 700);
  },

  initialize: function(options){
    _.bindAll(this, 'render', 'processScroll') 
  },

  render: function(){
    $(this.el).html(tpl);
    //$('#app').before(this.el)
    $win = $(window)
    isFixed = 0
    $win.on('scroll', this.processScroll)
    return this
  },
  
  processScroll: function() {
    if (typeof navTop === 'undefined')
      navTop =$(this.el).offset().top
    var i, scrollTop = $win.scrollTop();
    if (scrollTop >= navTop && !isFixed) {
      isFixed = 1;
      $(this.el).addClass('subnav-fixed');
    } else if (scrollTop <= navTop && isFixed) {
      isFixed = 0;
      $(this.el).removeClass('subnav-fixed');
    }
  }

})
})<commit_msg>scrolltop not working in ie9 either. fixed<commit_after>define(function(require) {

var tpl = require('text!templates/products/subnav.html')

return Backbone.View.extend({

  className: 'subnav',

  events: {
    "click a": "scroll",
  },

  scroll: function(e){
    e.preventDefault() 
    var anchor = $(e.currentTarget)
    // highlight
    var el = $(anchor).parent()
    if (el.hasClass('active')) return
    $('.subnav li').removeClass('active');
    el.addClass('active');
    var target = $(anchor).data("target");
    var position = $('#'+target).offset().top - 50

    var isMSIE = /*@cc_on!@*/0;
    if (isMSIE) {
       $('html').animate({
          'scrollTop': position 
      }, 700);
    } else {
       $('body').animate({
          'scrollTop': position 
      }, 700);
    }

  },

  initialize: function(options){
    _.bindAll(this, 'render', 'processScroll') 
  },

  render: function(){
    $(this.el).html(tpl);
    //$('#app').before(this.el)
    $win = $(window)
    isFixed = 0
    $win.on('scroll', this.processScroll)
    return this
  },
  
  processScroll: function() {
    if (typeof navTop === 'undefined')
      navTop =$(this.el).offset().top
    var i, scrollTop = $win.scrollTop();
    if (scrollTop >= navTop && !isFixed) {
      isFixed = 1;
      $(this.el).addClass('subnav-fixed');
    } else if (scrollTop <= navTop && isFixed) {
      isFixed = 0;
      $(this.el).removeClass('subnav-fixed');
    }
  }

})
})
{'fraction_non_alphanumeric': 0.19479090242112987, 'fraction_numerical': 0.007703595011005136, 'mean_word_length': 2.7875, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3857827', 'n_tokens_mistral': 929, 'n_tokens_neox': 898, 'n_words': 182}