Jquery Mobile Back Buttons -


i have application in programmatically add button page. means first page not have button on it. app has many ways of entering app, in other words can notification , in touching notification goes particular area in app. area not have backbutton go homepage, , if add 1 manually conflict programmed button.

so looking way add button go homepage when page loaded first , other times when visit page button performs expected.

i assume you're using data-add-back-btn=true dynamically add data-rel=back buttons pages. hence, possible first, checking if there no data-rel=back in active page and secondly, not home page.

one more thing, need remove button once navigate away page in order not overlap 1 jqm generate.

demo

var backbtn = '<a href="#home" data-icon="arrow-l" data-iconpos="notext" class="backbtn"></a>';  $(document).on('pagebeforeshow', function () {  var activepage = $.mobile.activepage;  if (activepage.find('[data-rel=back]').length === 0 && activepage[0].id != 'home') {   activepage.find('[data-role=header] h1').before(backbtn);  }  $('[data-role=page]').trigger('pagecreate');  $(document).on('pagebeforehide', function () {   $('a.backbtn').remove();  }); }); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -