javascript - jQuery mobile does not add back button? -
my head:
<head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <title></title> <script src="<?php echo base_url();?>/assets/js/vendor/modernizr-2.6.2.min.js"></script> <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0 target-densitydpi=medium-dpi'/> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> <!--jquery, mobile options, jqm--> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jquery || document.write('<script src="<?php echo base_url();?>assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script> <script src="<?php echo base_url();?>assets/js/transition.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> <script src="http://ricostacruz.com/jquery.transit/jquery.transit.min.js"></script> <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/normalize.css"> <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/main.css"> </head>
transition.js:
$(document).bind("mobileinit", function() { //back button $.mobile.page.prototype.addbackbtn = true; if (navigator.useragent.indexof("android") != -1) { $.mobile.defaultpagetransition = 'none'; $.mobile.defaultdialogtransition = 'none'; } else { $.mobile.defaultpagetransition = 'pop'; } });
why isn't being added?
make sure snippet after jquery library loads before jquerymobile library loaded:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> $(document).bind("mobileinit", function() { //back button $.mobile.page.prototype.options.addbackbtn = true; if (navigator.useragent.indexof("android") != -1) { $.mobile.defaultpagetransition = 'none'; $.mobile.defaultdialogtransition = 'none'; } else { $.mobile.defaultpagetransition = 'pop'; } }); </script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
refer to: jquery-mobile still "no button" (beta 2)
Comments
Post a Comment