mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
Fixed a typo/bug in scrollview.js that was causing the paging bool to be set improperly. Turned on scrollview paging in scrollview-direction.html. Items still left to do: - Code refactoring/cleanup. - Modify the code so that scroll offsets are stored as positive values. This will make it easier for folks to understand.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 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").attr("data-scroll", "y");
|
|
$page.find("[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 paging = st && st.search(/^[xy]p$/) != -1;
|
|
var dir = st && st.search(/^[xy]/) != -1 ? st.charAt(0) : null;
|
|
|
|
var opts = {};
|
|
if (dir)
|
|
opts.direction = dir;
|
|
if (paging)
|
|
opts.pagingEnabled = true;
|
|
|
|
$this.scrollview(opts);
|
|
}
|
|
});
|
|
|
|
ResizePageContentHeight(event.target);
|
|
});
|
|
|
|
$(document).live("orientationchange", function(event) {
|
|
ResizePageContentHeight($(".ui-page"));
|
|
});
|