mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
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) {
|
|
var $page = $(this);
|
|
$page.find(".ui-content, [data-scroll]").not(".ui-scrollview-clip").each(function(){
|
|
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") + "";
|
|
var snap = st && st.search(/^[xy]s$/ != -1);
|
|
var dir = st && st.search(/^[xy]/) != -1 ? st.charAt(0) : null;
|
|
|
|
var opts = {};
|
|
if (dir)
|
|
opts.direction = dir;
|
|
if (snap)
|
|
opts.snap = "viewport";
|
|
|
|
$this.scrollview(opts);
|
|
}
|
|
});
|
|
|
|
ResizePageContentHeight(event.target);
|
|
});
|
|
|
|
$(document).live("orientationchange", function(event) {
|
|
ResizePageContentHeight($(".ui-page"));
|
|
});
|