saunter.js
1.05 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
/**
* "逛"js
* @author: yue.liu@yoho.cn
* @date;2015/3/31
*/
var $ = require('jquery'),
ellipsis = require('mlellipsis'),
timer = null;
require('lazyload');
require('./saunter/article-type-three');
require('./saunter/article-type-three-optimize');
/**
* 初始化页面加载时的文字截取和图片懒加载功能
*/
exports.init = function() {
//相关文章截取文字
ellipsis.init();
clearTimeout(timer);
timer = setTimeout(function() {
//图片懒加载
$("img.lazy").lazyload({
placeholder : "data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=="
});
$("img.lazy").lazyload({
placeholder : "data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==",
event : "load",
container : $(".thumb-container")
});
//截取文字
$(".post-list").find("span").each(function(){
$(this).mlellipsis(2);
});
}, 0)
};