mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-03-16 22:10:25 +00:00
This version supports simulated scrolling via the CSS3 transform property by default, but also supports an option for positioning the old-fashioned way with top and left properties. Still some code clean-up to do, but folks can start playing with it. Some items/issues left to look into: - Experiment with event delegation so we can implement nested scrollviews. - Implement scroll direction locking. - Decide whether to conditionally inject clip/view markup. - Decide on final ui class names. - Decide on how scrolling behavior is actually invoked. (data-* attribute or class) - Decide on final set of notifications we'll need to fire off. - Add an API so that scroll position can be adjusted after a resize/orientation change. - Documentation that describes potential problems with performance, memory usage, etc, and workarounds.
22 lines
853 B
JavaScript
22 lines
853 B
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));
|
|
|
|
$page.children(".ui-content:not(.ui-scrollview-clip):not(.ui-scrolllistview)").scrollview({ direction: "vertical" });
|
|
$page.children(".ui-content.ui-scrolllistview:not(.ui-scrollview-clip)").scrolllistview();
|
|
}
|
|
|
|
$("[data-role=page]").live("pageshow", function(event) {
|
|
ResizePageContentHeight(event.target);
|
|
});
|
|
|
|
$(document).live("orientationchange", function(event) {
|
|
ResizePageContentHeight($(".ui-page"));
|
|
});
|