app/assets/javascripts/hooch.js in hooch-0.14.5 vs app/assets/javascripts/hooch.js in hooch-0.14.6
- old
+ new
@@ -1503,10 +1503,23 @@
if (hooch.scroll_keys[e.keyCode]) {
hooch.preventDefault(e);
return false;
}
},
+ Atarget: Class.extend({
+ init: function($atarget){
+ $atarget.on('click', function(e) {
+ e.preventDefault();
+ var whichAnchor = $(this).attr('href');
+ if($(whichAnchor).length) {
+ $('html, body').animate({
+ scrollTop: $(whichAnchor).offset().top -90
+ }, 1000);
+ }
+ });
+ }
+ }),
BindKey: Class.extend({
init: function($bound_element){
this.$bound_element = $bound_element
this.element_type = $bound_element.get(0).nodeName.toLowerCase()
this.key_name = $bound_element.data('bind-key')
@@ -1757,10 +1770,10 @@
},'hooch');
window.any_time_manager.registerList(
['hover_overflow','hidey_button','hide-show','submit-proxy','click-proxy','field-filler','revealer',
'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
'hover-reveal', 'emptier', 'remover', 'checkbox-proxy', 'fake-checkbox', 'fake-select', 'select-action-changer',
- 'sorter','bind-key','modal-trigger','history-pusher', 'history-replacer', 'link'],'hooch');
+ 'sorter','bind-key','modal-trigger','history-pusher', 'history-replacer', 'link', 'atarget'],'hooch');
window.any_time_manager.load();
};
hooch.pauseEvent = function(e){
if(e.stopPropagation) e.stopPropagation();
if(e.preventDefault) e.preventDefault();