jQM Template

by Dragan Gaić

HTML

<link rel="stylesheet" href="http://jeromeetienne.github.com/jquery-mobile-960/css/jquery-mobile-fluid960.css">
<script src="http://timeago.yarp.com/jquery.timeago.js"></script>
<script src="http://imakewebthings.github.com/jquery-waypoints/waypoints.min.js"></script>
<!DOCTYPE html>
<html>
    <head>
        <title>jQM Complex Demo</title>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
        <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>    
    </head>
    <body>
        <div data-role="page" id="mainPage">
            <button id="createEvent">Create Event</button>
        </div>    
        <div data-role="dialog" id="addCatForm" data-theme="c">
            <div data-role="header">
                <h3>here is some text</h3>
            </div>
            <div data-role="content">
                <input type="text" id="catText"/>
                <input data-role="button" data-mini="true" data-theme="b" data-inline="true" type="submit" id="addCat" value="Add Category"/>
                
                <button data-role="button" data-mini="true" data-theme="c" data-inline="true" id="canCat">Cancel</button>
            </div>
        </div>        
    </body>
</html>

JavaScript

$(document).on('pageinit', '#mainPage', function(){ 
    $(document).on ('click','#createEvent', function () {        
        $.mobile.changePage('#addCatForm', {
            transition: 'pop',
            changeHash: true,
            role: 'dialog'
        });
    });
    
    $(document).on('click','#canCat',function () {
        $('#addCatForm').dialog('close');
    });        
});