-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetSwiperHieghtAndWidth.js
More file actions
42 lines (36 loc) · 1.98 KB
/
setSwiperHieghtAndWidth.js
File metadata and controls
42 lines (36 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function fp_sizeWrapper(bodySelector, headerSelector, footerSelector) {
//document.addEventListener("backbutton", onBackKeyDown, false);
//var script = document.createElement('script');
//script.src = 'cordova-2.4.0.js';
//script.type = 'text/javascript';
//document.getElementsByTagName('head')[0].appendChild(script);
//alert(screenWidth+"=="+screenHight);
var winWidth = $(window).width();
var winHeight = $(window).height();
$("#orient").width(winWidth);
$("#orient").height(winHeight);
var overhead = 0;
if (bodySelector != undefined && bodySelector != "") {
var innerWrap = $("#content1");
if (innerWrap.length > 0) {
overhead += parseInt(innerWrap.css("marginTop")) + parseInt(innerWrap.css("marginBottom")) + parseInt(innerWrap.css("paddingTop")) + parseInt(innerWrap.css("paddingBottom"));
}
if (headerSelector != undefined && headerSelector != "") {
$(headerSelector).each(function () {
overhead += $(this).height() + parseInt($(this).css("marginTop")) + parseInt($(this).css("marginBottom")) + parseInt($(this).css("paddingTop")) + parseInt($(this).css("paddingBottom"));
});
}
if (footerSelector != undefined && footerSelector != "") {
var bottomNav = $(footerSelector);
if (bottomNav.length > 0) {
overhead += bottomNav.height() + parseInt(bottomNav.css("marginTop")) + parseInt(bottomNav.css("marginBottom")) + parseInt(bottomNav.css("paddingTop")) + parseInt(bottomNav.css("paddingBottom"));
}
}
var content = $(bodySelector);
if (content.length > 0) {
overhead += parseInt(content.css("marginTop")) + parseInt(content.css("marginBottom")) + parseInt(content.css("paddingTop")) + parseInt(content.css("paddingBottom"));
content.height(Math.max(0, winHeight - overhead));
//$("#scrollwrapper").height(content.height() - 20);
}
}
}