pageshow for flot and jq mobile
http://stackoverflow.com/questions/12505493/why-do-my-flot-y-axis-labels-appear-over-the-axis-jqm
by ryleyb
HTML
<script src="http://people.iola.dk/olau/flot/jquery.flot.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css">
<div data-role="page" id="device1">
<h3 style="margin-top:27px;margin-left:68px;margin-bottom:10px">Your Progress</h3>
<div id="body-fat-graph" style="width:375px;height:250px;"></div>
</div>
<div data-role="page" id="device2">
<h3 style="margin-top:27px;margin-left:68px;margin-bottom:10px">Your Progress</h3>
<div id="total-inches-graph" style="width:375px;height:250px;"></div>
</div>
<div data-role="page" id="device3">
<h3 style="margin-top:27px;margin-left:68px;margin-bottom:10px">Your Progress</h3>
<div id="weight-graph" style="width:375px;height:250px;"></div>
</div>
JavaScript
$('.ui-slider-handle').live('touchstart', function() {
// When user touches the slider handle, temporarily unbind the page turn handlers
doUnbind();
});
$('.ui-slider-handle').live('mousedown', function() {
// When user touches the slider handle, temporarily unbind the page turn handlers
doUnbind();
});
$('.ui-slider-handle').live('touchend', function() {
//When the user let's go of the handle, rebind the controls for page turn
// Put in a slight delay so that the rebind does not happen until after the swipe has been triggered
setTimeout(function() {
doBind();
}, 100);
});
$('.ui-slider-handle').live('mouseup', function() {
//When the user let's go of the handle, rebind the controls for page turn
// Put in a slight delay so that the rebind does not happen until after the swipe has been triggered
setTimeout(function() {
doBind();
}, 100);
});
// Set the initial window (assuming it will always be #1
window.now = 1;
//get an Array of all of the pages and count
windowMax = $('div[data-role="page"]').length;
doBind();
// Functions for binding swipe events to named handlers
function doBind() {
$('div[data-role="page"]').live("swipeleft", turnPage);
$('div[data-role="page"]').live("swiperight", turnPageBack);
}
function doUnbind() {
$('div[data-role="page"]').die("swipeleft", turnPage);
$('div[data-role="page"]').die("swiperight", turnPageBack);
}
// Named handlers for binding page turn controls
function turnPage() {
// Check to see if we are already at the highest numbers page
if (window.now < windowMax) {
window.now++$.mobile.changePage("#device" + window.now, "slide", false, true);
}
}
function turnPageBack() {
// Check to see if we are already at the lowest numbered page
if (window.now != 1) {
window.now--;
$.mobile.changePage("#device" + window.now, "slide", true, true);
}
}
var weightArray = [[1325404800000,...