2010-11-18 23:12:27 +00:00
|
|
|
function ResizePageContentHeight(page)
|
|
|
|
|
{
|
|
|
|
|
var $page = $(page);
|
|
|
|
|
var $content = $page.children(".ui-content");
|
|
|
|
|
var hh = $page.children(".ui-header").outerHeight(); hh = hh ? hh : 0;
|
|
|
|
|
var fh = $page.children(".ui-footer").outerHeight(); fh = fh ? fh : 0;
|
|
|
|
|
var pt = parseFloat($content.css("padding-top"));
|
|
|
|
|
var pb = parseFloat($content.css("padding-bottom"));
|
|
|
|
|
var wh = window.innerHeight;
|
|
|
|
|
$content.height(wh - (hh + fh) - (pt + pb));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("[data-role=page]").live("pageshow", function(event) {
|
2010-12-01 22:04:54 +00:00
|
|
|
var $page = $(this);
|
2010-12-02 17:47:46 +00:00
|
|
|
$page.find(".ui-content").attr("data-scroll", "y");
|
|
|
|
|
$page.find("[data-scroll]:not(.ui-scrollview-clip)").each(function(){
|
2010-12-01 22:04:54 +00:00
|
|
|
var $this = $(this);
|
|
|
|
|
// XXX: Remove this check for ui-scrolllistview once we've
|
|
|
|
|
// integrated list divider support into the main scrollview class.
|
|
|
|
|
if ($this.hasClass("ui-scrolllistview"))
|
|
|
|
|
$this.scrolllistview();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var st = $this.data("scroll") + "";
|
2010-12-02 17:47:46 +00:00
|
|
|
var paging = st && st.search(/^[xy]p$/) != -1;
|
2010-12-01 22:04:54 +00:00
|
|
|
var dir = st && st.search(/^[xy]/) != -1 ? st.charAt(0) : null;
|
|
|
|
|
|
|
|
|
|
var opts = {};
|
|
|
|
|
if (dir)
|
|
|
|
|
opts.direction = dir;
|
2010-12-02 17:47:46 +00:00
|
|
|
if (paging)
|
|
|
|
|
opts.pagingEnabled = true;
|
2010-12-01 22:04:54 +00:00
|
|
|
|
|
|
|
|
$this.scrollview(opts);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2010-11-18 23:12:27 +00:00
|
|
|
ResizePageContentHeight(event.target);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).live("orientationchange", function(event) {
|
|
|
|
|
ResizePageContentHeight($(".ui-page"));
|
|
|
|
|
});
|