jQuery Mobile: Slider tooltip

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

For a better UI, you can also use slider with a tooltip.

To have the value shown on the slider indicator, we can use data-show-value=’true’.

<!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>Slider with tooltip</h1>

    <div data-role='content'>
            <label for='slider1'>Slider with tooltip:</label>
            <input type='range' name='slider1' id='slider1' min='0' max='100' value='50' data-popup-enabled='true'>
            <label for='slider2'>Slider showing value on button:</label>
            <input type='range' name='slider2' id='slider2' min='0' max='100' value='50' data-show-value='true'>
            <label for='slider3'>Both options together:</label>
            <input type='range' name='slider3' id='slider3' min='0' max='100' value='50' data-show-value='true' data-popup-enabled='true'>
            <label for='slider4'>Both options together (mini):</label>
            <input type='range' name='slider4' id='slider4' min='0' max='100' value='50' data-show-value='true' data-popup-enabled='true' data-mini='true'>

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

Try The Code
Series Navigation<< jQuery Mobile: Flip toggle switch
jQuery Mobile: Table column toggle >>

Leave a comment

Leave a Reply