diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 9afb28294..0bad32b4e 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -434,6 +434,28 @@ $.extend(fixmystreet.set_up, { }); }, + hide_name: function() { + $('body').on('click', '.js-hide-name', function(e){ + e.preventDefault(); + + var $p = $(this).parents('p'); + var $form = $p.next('.hide-name-form'); // might not exist yet + var url = $(this).attr('href'); + + if ($form.length) { + $form.slideUp(function(){ + $form.remove(); + }); + } else { + $.get(url).done(function(html){ + $(html).find('.hide-name-form').hide().insertAfter($p).slideDown(); + }).fail(function(){ + window.location.href = url; + }); + } + }); + }, + on_resize: function() { var last_type; $(window).on('resize', function() { |