diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-03-01 20:35:56 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-03-01 20:35:56 +0000 |
commit | 2e697be14d06a9ef1bfe0bdb97b7820fb04d45c2 (patch) | |
tree | cf39c7479c8302fbf865a9b185eb03e6d5b00546 /web/cobrands | |
parent | 37ddd5723ea69097f83c24ff279c3865ba8dc102 (diff) |
Allow back button to work when reading mobile reporting notes, fixes #260.
Diffstat (limited to 'web/cobrands')
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index af8ad2cff..427e2f9cc 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -261,29 +261,31 @@ $(function(){ //show/hide notes on mobile $('.mobile #report-a-problem-sidebar').after('<a href="#" class="rap-notes-trigger button-right">How to send successful reports</a>').hide(); - $('.mobile').on('click', '.rap-notes-trigger', function(e){ + $('.rap-notes-trigger').click(function(e){ e.preventDefault(); //check if we've already moved the notes if($('.rap-notes').length > 0){ //if we have, show and hide .content - $('.mobile .content').hide(); + $('.content').hide(); $('.rap-notes').show(); }else{ //if not, move them and show, hiding .content - $('.mobile .content').after('<div class="content rap-notes"></div>').hide(); + $('.content').after('<div class="content rap-notes"></div>').hide(); $('.rap-notes').css({ paddingTop: $(window).height() }); - $('#report-a-problem-sidebar').appendTo('.rap-notes').show().after('<a href="#" class="rap-notes-close button-left">BACK</a>'); + $('#report-a-problem-sidebar').appendTo('.rap-notes').show().after('<a href="#" class="rap-notes-close button-left">Back</a>'); } $('html, body').scrollTop($('#report-a-problem-sidebar').offset().top); + location.hash = 'rap-notes'; }); $('.mobile').on('click', '.rap-notes-close', function(e){ e.preventDefault(); //hide notes, show .content - $('.mobile .content').show(); + $('.content').show(); $('.rap-notes').hide(); - $('html, body').scrollTop($('#report-a-problem-main').offset().top); + $('html, body').scrollTop($('#mob_ok').offset().top); + location.hash = 'report'; }); //move 'skip this step' link on mobile |