我在一个项目中使用iScroll并得到一个starnge行为,其中iScroll从父div获得高度,我希望它使用我传入它的div的高度。
我设法在jsFiddle:http://jsfiddle.net/wjtbxpmc/
中重现了这一点代码基本上是:
-m, --memory="" Memory limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g. Minimum is 4M.
--memory-swap="" Total memory limit (memory + swap, format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g.
--memory-reservation="" Memory soft limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g.
--kernel-memory="" Kernel memory limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g. Minimum is 4M.
SELECT YEAR,SMC,SMC,SG,SPN,ISGR,[1] AS [JAN],[2] AS [FEB],[3] AS [MAR] , [1] + [2] + [3] AS [FY]
FROM @TAB1
PIVOT
(
SUM(NPS)
FOR [MONTH] IN ([1],[2],[3])
)AS pvt
function findClosest(el, selector) { // this is just to find closest parent by class
var isClass = selector.indexOf('.') == 0;
if (isClass) while ((el = el.parentElement) && !el.classList.contains(selector.slice(1)));
else while ((el = el.parentElement) && el.tagName.toLowerCase() != selector);
return el;
}
var table = document.querySelector('table');
for (var i = 0; i < 50; i++) {
var tr = document.createElement('tr');
var td = document.createElement('td');
td.innerHTML = 'Line ' + i;
tr.appendChild(td);
table.appendChild(tr);
}
var scrollDiv = findClosest(table, '.scrollable');
new IScroll(scrollDiv, {
mouseWheel: true,
scrollbars: true,
click: true
});
答案 0 :(得分:0)
好的,好像在position: relative;
添加.scrollable
修复了问题。
如果不是这样做的话,欢迎提供更多答案。