app/assets/javascripts/hooch.js in hooch-0.15.1 vs app/assets/javascripts/hooch.js in hooch-0.15.2

- old
+ new

@@ -1,12 +1,26 @@ var initHooch = function(){ hooch = { Emptier: Class.extend({ init: function($emptier){ var $target = $($emptier.data('target')); + var emptier = this + var scroll_to_selector = $emptier.data('scroll-to') + if($(scroll_to_selector).length > 0){ + this.scroll_to = $(scroll_to_selector) + } $emptier.click(function(e){ $target.empty(); + if(emptier.scroll_to){ + if($('[data-hooch-offset]').length > 0){ + extra_offset = $('[data-hooch-offset]').outerHeight() + } + $('html, body').animate({ + scrollTop: emptier.scroll_to.offset().top - extra_offset + }, 300); + + } }) } }), Toggler: Class.extend({ init: function(jq_obj){ @@ -507,10 +521,12 @@ this.getPushState(); this.getTarget(); var tab_trigger = this; $tab_trigger.on('click', function(e){ e.preventDefault(); + tab_trigger.$tab_trigger.trigger('tabTriggerClicked') tab_trigger.toggleTarget() + tab_trigger.$tab_trigger.trigger('tabLoaded') }) }, getTarget: function(){ this.$target = $('[data-tab-id="' + this.tab_id + '"]'); },