 
						temple:(假如{{}}渲染冲突,可以在front.js中,正则里修改成别的字符)
具体自适应:(在全局函数中定义全局变量,可以是固定数值,也可以通过计算获得)
| 1 2 3 4 5 6 | varMIN_COLUMN_COUNT = 2; // minimal column countvarCOLUMN_WIDTH = 152.5;   // cell width: 190, padding: 14 * 2, border: 1 * 2varCELL_PADDING = 26;    // cell padding: 14 + 10, border: 1 * 2varGAP_HEIGHT = 5;      // vertical gap between cellsvarGAP_WIDTH = 5;       // horizontal gap between cellsvarTHRESHOLD = 2000;     // determines whether a cell is too far away from viewport (px) | 
渲染方法:
| 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 | varappendCells = function(num) {   if(loading) {     // Avoid sending too many requests to get new cells.     return;   }   varxhrRequest = newXMLHttpRequest();   varfragment = document.createDocumentFragment();   varcells = [];   varimages;   xhrRequest.open('GET', 'json.php?n='+ num, true);   xhrRequest.onreadystatechange = function() {     if(xhrRequest.readyState == 4 && xhrRequest.status == 200) {       images = JSON.parse(xhrRequest.responseText);       for(varj = 0, k = images.length; j < k; j++) {         varcell = document.createElement('div');         cell.className = 'cell pending';         cell.tagLine = images[j].title;         cells.push(cell);         console.log(images[j])         front(cellTemplate, images[j], cell);         fragment.appendChild(cell);       }       cellsContainer.appendChild(fragment);       loading = false;       adjustCells(cells);     }   };   loading = true;   xhrRequest.send(null); }; | 
如果使用appendCells 方法,最后isGithubDemo请改为false:
| 1 2 3 4 5 6 7 8 9 | // If there's space in viewport for a cell, request new cells.if(viewportBottom > getMinVal(columnHeights)) {    // Remove the if/else statement in your project, just call the appendCells function.    if(isGithubDemo) {        appendCellsDemo(columnCount);    } else{        appendCells(columnCount);    }} | 
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com