jQuery Mobile: Tooltip

This entry is part 57 of 73 in the series jQuery Mobile

A tooltip can be created by adding a theme swatch to a basic popup and adding padding via the ui-content class.

Here we also show how you can custom style the tooltip button.

<!DOCTYPE html>
    <link href='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css' rel='stylesheet'/>
    <script src='http://code.jquery.com/jquery-1.10.2.min.js'></script>
    <script src='http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js'></script>
<div data-role='page'>
    <div data-role='header' data-theme='b'>
        <h1>A Tooltip App</h1>

    <div data-role='content' style='text-align: center'>
        <p>A paragraph with a tooltip. <a href='#popupInfo' data-rel='popup' data-transition='pop' class='my-tooltip-btn ui-btn ui-alt-icon ui-nodisc-icon ui-btn-inline ui-icon-info ui-btn-icon-notext' title='Learn more'>Learn more</a></p>
        <div data-role='popup' id='popupInfo' class='ui-content' data-theme='a' style='max-width:350px;'>
            <p>Here is a <strong>tiny popup</strong> being used like a tooltip. The text will wrap to multiple lines as needed.</p>

    <div data-role='footer' data-position='fixed'>
        <h4 style='text-align:center;'>I'm the footer</h4>

Try The Code
Series Navigation<< jQuery Mobile: A basic popup
jQuery Mobile: Photo Lightbox >>

Leave a comment

Leave a Reply