jQuery Mobile - Buttons in Footers


Advertisements


Description

The ui-btn-left and ui-btn-right classes cannot be used in the footer. However, you can still create the same appearance using custom CSS.

Example

Following example demonstrates the use of buttons in footers in jQuery Mobile.

Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Buttons in footers</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
      <style>
         .footer-button-left,
         .footer-button-right {
            position: absolute;
            margin: 0;
            top: auto;
            bottom: 0.24em;
         }
      
         .footer-button-left {
            left: 0.4em;
         }
      
         .footer-button-right {
            right: 0.4em;
         }
      </style>
   </head>
   
   <body>
      <div data-role = "footer">
         <h2>Footer</h2>
         <a href = "#" class = "ui-btn ui-corner-all ui-btn-inline ui-mini 
            footer-button-left ui-btn-icon-left ui-icon-home">Home</a>
         <a href = "#" class = "ui-btn ui-corner-all ui-btn-inline ui-mini 
            footer-button-right ui-btn-icon-right ui-icon-gear">Options</a>
      </div>
   </body>
</html>

Output

Let's carry out the following steps to see how the above code works −

  • Save the above html code as toolbar_buttons_footer.html file in your server root folder.

  • Open this HTML file as https://localhost/toolbar_buttons_footer.html and the following output will be displayed.


jquery_mobile_widgets.htm

Advertisements